[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum moderator: shanky, Piyu, Resh  
Forum » Open System-Linux » Linux System questionare » unix awk (Awk command)
unix awk
ddd0808Date: Friday, 2014-12-26, 10:49 AM | Message # 1
Private
Group: Users
Messages: 1
Awards: 0
Reputation: 0
Status: Offline
Hello ,

pls let me know this:

To insert a new column (say serial number) before the 1st column  and  to insert a new column after the last column..

Please  let me know these...

Link:http://www.theunixschool.com/2012/11/awk-examples-insert-remove-update-fields.html
 
shankyDate: Friday, 2014-12-26, 3:06 PM | Message # 2
Lieutenant
Group: Administrators
Messages: 46
Awards: 0
Reputation: 104
Status: Offline
Hello ddd0808
To insert a serial number before the first column, you can use sed tool itself.
 
#>sed '/./=' filename|sed 'N;s/\n/ /'
The above command will put numbering 1,2,3.. in front of each line.
 
To insert a new cloumn after last , you can use:
shanky@localhost:> sed 'G;s/\n/ wd/' test1
1 first wd
2 second wd
3 third wd

Here, 'wd' is the word to be put in each line at last column

I hope this helps. If any issues, reach again.


s.k.bhagat
 
Forum » Open System-Linux » Linux System questionare » unix awk (Awk command)
  • Page 1 of 1
  • 1
Search: