I need all of it to be on one line, with a space in between and some additional text, so I wrote this:1.1.1.1 2.2.2.2 3.3.3.3
This gives me this: dest (1.1.1.1 2.2.2.2 3.3.3.3 ) So far so good. Now, I need to delete the space before ")", so i tried this simple one-liner:open(SESIP2, ">sesip2"); open(MYINPUTFILE, "sesip1"); while (<MYINPUTFILE>) { my($line) = $_; chomp($line); print SESIP2 "$line "; } close(MYINPUTFILE); close(SESIP2); open(SESIP3, ">sesip3"); open(MYINPUTFILE, "sesip2"); while (<MYINPUTFILE>) { my($line) = $_; print SESIP3 "dest \($line\)"; } close(MYINPUTFILE); close(SESIP3);
For some reason, this deletes the entire line, not just the space. Any ideas? I should probably mention that the IP addresses are stdin that get asked of the user earlier on. Everything else works like a charm, I just can't seem to get rid of that one space.system "sed 's/ )/)/' sesip3 > sesip2";
In reply to why does 'sed' remove the entire line? by ddrew78
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |