Hi
Is there a unix script that will change the text in lefthand column to text in righthand column.
0 0
1 1
10 10
100 100
1000 1000
1001 1001
1002 1002
1003 1003
1004 1004
1005 1005
1006 1006
1007 1007
1008 1008
1009 1009
101 101
1010 1010
1011 1011
1012 1012
1013 1013
1014 1014
1015 1015
1016 1016
1017 1017
1018 1018
1019 1019
102 102
Not entirely sure what you are after as both columns contain the same data but if want to swap what is in the first column with what is in the second column you could do:
$ awk '{ print $2" "$1 }' inputfile > outputfile
e.g.:
$ cat inputfile
aaa bbb
ccc ddd
1000 2000
1001 2002
$ awk '{ print $2" "$1 }' inputfile > outputfile
$ cat outputfile
bbb aaa
ddd ccc
2000 1000
2002 1001
$
If you want to replace what is in the first column with what is in the second column then you could do:
$ awk '{ print $2" "$2 }' inputfile > outputfile
e.g.
~$ awk '{ print $2" "$2 }' inputfile > outputfile
$ cat outputfile
bbb bbb
ddd ddd
2000 2000
2002 2002
$
can't understand what exactly you want..?
This might explain what I want to do. See attached text document.
print the values of column in right justified manner refer man page of printf
@ vidyadhar85
Could you please give me the command line to do this change from left justify to right justify. Tnx.
use this...
awk '{printf "%+4s\n",$0}' filename
@ vidyadhar85
Perfect. Thanks for your help.