substitution in c-shell script

Status
Not open for further replies.

vikas.m0502

Junior Member level 1
Joined
May 11, 2012
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,389
I have one file :
mem_x mem_x
mem_x mem_x
...
mem_x mem_x

I want to change this to :
mem_1 mem_1
mem_2 mem_2
...
mem_n mem_n

I am trying it with csh script but it keeps giving some error.
Please help.
Thanks in advance.
 

This perl one liner will do it
perl -pi -e 's/x/$./g' <file_name>
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…