Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I’m struggling to write a script to do the following,
-will go through each line in the file
-in a specific character positions, changes
the value to a new value
-These character positions are fixed througout the file-----------------------
e.g.: file1.sh will have the following 3 lines,line1 aaaa xxxx
line2 bbbb yyyy
line3 cccc zzzzAfter executing the script, content of file1.sh should be,
line1 a1aa xx4x
line2 b1bb yy4y
line3 c1cc zz4z
-----------------------Guru's, thanks a ton in advance
Vini

Hi Nails,
Thanks a lot for the response.
After digging through the net and "sed" man pages came up with the following,
--------------------
sed -e "1n; s/./1/2" -e "s/./4/8" file1.sh > file2.sh
mv file2.sh file1.sh
--------------------This is giving me the required output & I'm doing some testing on the same.
Thanks Again
Regards
Vini

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |