Hi,
I'm new to shell programming. Need some help in the following requirement:
I have a file origFile.txt with values:
origFile.txt
.00~ 145416.02~ xyz~ ram kishor
.35~ 765.76~ anh reid~ kishna kerry
Now each row in the file has value for 4 columns with "~" as delimiter.
Now I need to erase the blank spaces between "~" and each column value. Also I need to remove the blank space between the begining of each line and the first column value.
The output file modFile.txt should look like
modFile.txt
.00~145416.02~xyz~ram kishor
.35~765.76~anh reid~kishna kerry
Could anyone please help me in writing the shell script for the same?
If the origFile.txt has " " (space) value for any of the columns then the space is getting trimmed. e.g.
origFile.txt
.00~ 145416.02~ ~ ram kishor
.35~ 765.76~ anh reid~ kishna kerry
The output now looks like
modFile.txt
.00~145416.02~~ram kishor
.35~765.76~anh reid~kishna kerry
Is it possible to write a script which will give the o/p as
modFile.txt
.00~145416.02~ ~ram kishor
.35~765.76~anh reid~kishna kerry
Basically to leave a space between the delimiters if the value for the column is " " (space) i.e. ~ ~ instead of ~~