Tuesday, December 6, 2011

column command for formatting data

ubuntu1004@ubuntu1004:~$ cat -n file.cvs
     1 Cars $5000 10
     2 Beer $5 1000
     3 Computers $500 100
ubuntu1004@ubuntu1004:~$ column -t file.cvs
Cars       $5000  10
Beer       $5     1000
Computers  $500   100
ubuntu1004@ubuntu1004:~$ cat file.cvs |column -t
Cars       $5000  10
Beer       $5     1000
Computers  $500   100
ubuntu1004@ubuntu1004:~$ pico file.cvs
ubuntu1004@ubuntu1004:~$ cat -n file.cvs
     1 Old Cars $5000 10
     2 Beer $5 1000
     3 Computers $500 100
ubuntu1004@ubuntu1004:~$ cat file.cvs |column -t
Old        Cars  $5000  10
Beer       $5    1000
Computers  $500  100
ubuntu1004@ubuntu1004:~$ pico !!:1
pico file.cvs
ubuntu1004@ubuntu1004:~$ cat -n !!:1
cat -n file.cvs
     1 Cars|$5000|10
     2 Beer|$5|1000
     3 Computers|$500|100
ubuntu1004@ubuntu1004:~$ column -t -s "|" file.cvs
Cars       $5000  10
Beer       $5     1000
Computers  $500   100
ubuntu1004@ubuntu1004:~$ pico !-2:2
pico file.cvs
ubuntu1004@ubuntu1004:~$ !-3
cat -n file.cvs
     1 Old Cars|$5000|10
     2 Beer|$5|1000
     3 Computers|$500|100
ubuntu1004@ubuntu1004:~$ !-3
column -t -s "|" file.cvs
Old Cars   $5000  10
Beer       $5     1000
Computers  $500   100

No comments:

Post a Comment