Dear All,
can you please advice how do i remove trailing and leading spaces from a pipe-delimited file using "tr" command
the below cmd, i tried removed all spaces
tr -d ' '<s1.txt>s2.txt1
Many thx
Suresh
Dear All,
can you please advice how do i remove trailing and leading spaces from a pipe-delimited file using "tr" command
the below cmd, i tried removed all spaces
tr -d ' '<s1.txt>s2.txt1
Many thx
Suresh
could you post some sample data from your pipe-delimited file?
Something like this?
sed 's/ | /|/g' s1.txt > s2.txt1
Regards
Hi
Source file looks like this
cat s1.txt
3301|2009-02-01 00:00:00 |K|GGG|TR|2009-02-12 16:30:58 |ad |12
Desired Output
3301|2009-02-01 00:00:00||K|GGG|TR|2009-02-12 16:30:58||ad|12
Would appreciate if we have a command in "tr"
Regards,
Suresh
echo "3301|2009-02-01 00:00:00 |K|GGG|TR|2009-02-12 16:30:58 |ad |12" |tr ' ' '|'
3301|2009-02-01|00:00:00||K|GGG|TR|2009-02-12|16:30:58||ad||12
That does not match the desired output - you have put a | between date and time.