Skip to content

Shell pipelines or sub-shells #73

@egrieco

Description

@egrieco

I'd like to use ripcal to convert the IP ranges in a file on all ASNs into CIDR notation. Unfortunately, ripcal does not have clean output (I may modify it).

Running it with IPs as an argument:

ripcal 1.0.181.0-1.0.182.255
1.0.181.0-1.0.182.255 = 1.0.181.0/22
1.0.181.0/22 = 1.0.180.0 - 1.0.183.255

Running it with IPs passed in on STDIN:

echo "1.0.1.0-1.0.3.255" | ripcal
1.0.1.0/22
1.0.1.0/22 = 1.0.0.0 - 1.0.3.255

So in order to get the output I need, I must run something like echo $1 | ripcal | head -n 1 | tr -d "\n". Unfortunately, I cannot pass this in to teip by enclosing it in quotes and the shell will interpret the pipes such that the output of teip gets piped to head.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions