I have this file, ipaddresses.txt
152.48.64.13
146.112.164.43
236.157.219.229
188.201.225.93
193.140.79.73
...
And this file, cidr.txt
20
21
8
20
21
...
And I want the output file to be like this:
152.48.64.13/20
146.112.164.43/21
236.157.219.229/8
188.201.225.93/20
193.140.79.73/21
...
How to achieve this?
sed
, specifically? have you considered alternatives - such aspaste -d/ ipaddresses.txt cidr.txt
?sed
to do this kind of task, I will edit my thread. By the way, I tried usingpaste
, it doesn't append to the last line, but it append a new line each.paste
command by steeldriver works. Do you not have GNUpaste
or is there something with your environment such as an alias?paste -d/ ipaddresses.txt cidr.txt > out.txt
. When I try to do it without outputting a file, It prints a different behaviour. It adds \ in the beginning of each line but It does correctly for the very last line. Hmm