|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Changing a value 11th character of each line
Hi
I've a file there are around 1000 rows in it. In each row at 25th position i've either value '1' or '2' I would like to know the script or command which can swap the values. If 1 is there on one line It should be changes to 2. If 2 is there on one line It should be changes to 1. Thanks in advance Sachin |
|
#2
|
|||
|
|||
|
put this in sedcmd:
s/\(.\{25\}\)\([12]\)\(.*\)/\1+++\2+++\3/ s/+++1+++/2/ s/+++2+++/1/ then enter: sed -f sedcmd inputfile >output |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Changing a value 11th character of each line |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|