Results 1 to 2 of 2
Hi Everybody,
I want to add some data at the end of a line in a file..
For example:
contents of my /etc/group file are:
nobody::60001:
noaccess::60002:
nogroup::65534:
nms::2500:nms1,nms2,nms3,nms4
ctxadm::55000:
...
- 02-07-2008 #1Linux Newbie
- Join Date
- Jul 2004
- Posts
- 143
adding some data at the end of a line
Hi Everybody,
I want to add some data at the end of a line in a file..
For example:
contents of my /etc/group file are:
nobody::60001:
noaccess::60002:
nogroup::65534:
nms::2500:nms1,nms2,nms3,nms4
ctxadm::55000:
sybase::202:
Here I want to add nms5 in nms group, means at the end of line.
How can I achieve this.
Please help me.
Thanks Inadvance,
Mummaneni.
- 02-07-2008 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
With awk:
RegardsCode:awk '/nms:/{print $0",nms5";next}{print}' /etc/group > temp_file mv temp_file /etc/group


Reply With Quote