I have a file which was pipe delimited, I need to make it tab delimited. I tried with sed but no use
cat file | sed 's/|//t/g'
The above command substituted "/t" not tab in the place of pipe.
Sample file:
abc|123|2012-01-30|2012-04-28|xyz
have to convert to:
abc 123 2012-01-30 2012-04-28 xyz
Thanks!
echo 'abc|123|2012-01-30|2012-04-28|xyz' | tr '|' '\t'
Hi,
you can achieve that with the following code
$ cat file.txt | sed 's/|/\t/g'
abc 123 2012-01-30 2012-04-28 xyz
thanks,
venkat
You get a useless use of cat award.
sed 's/|/\t/g' < file.txt
# echo "abc|123|2012-01-30|2012-04-28|xyz" | sed 's/|/ /g'
abc 123 2012-01-30 2012-04-28 xyz
He is looking for Tab Space and not Blank Space... hence
sed -e 's/|/\t/g' inputfile > outputfile
1 Like
try this
echo "abc|123|2012-01-30|2012-04-28|xyz" | tr '|' '\t'
Output:
abc 123 2012-01-30 2012-04-28 xyz
Thanks,
Kalai