I was hoping someone could help me, I need to reverse the contents of each line in a file. So basically this: 101.228.168.192 to 192.168.228.101 Is there a command I could use in a bash script, or even just the logic needed to get the job done. Thanks
+6
A:
You could use awk:
awk -F'.' '{print $4"."$3"."$2"."$1}' file.txt > output.txt
Mark Byers
2010-10-14 16:42:08
Thanks, that did exactly what I needed.
Brimak
2010-10-14 16:51:22
+3
A:
sed 's/\(.*\)\.\(.*\)\.\(.*\)\.\(.*\)/\4.\3.\2.\1/g' filename.txt
thanks for the comment Sean
Levon Mirzoyan
2010-10-14 16:56:12