Hi Gurus!
Example file:
1;AAA;BBB
2;CCC;DDD
We want to replace semicolons to tabulators.
Like this:
1 AAA BBB
2 CCC DDD
We have tried these codes.
With PERL:
#!/bin/bash
for i in `find /folder1/ -name "*.CSV"`
do
bi="`basename $i awk -F"." {'print $1'}`"
cat $bi.CSV perl -p -e 's/;/\t/g' > /folder1/$bi.TXT
mv $bi.CSV /folder2/
done
and same with SED:
#!/bin/bash
for i in `find /folder1/ -name "*.CSV"`
do
bi="`basename $i awk -F"." {'print $1'}`"
sed 's/;/\t/g' $i > /folder1/$bi.TXT
mv $bi.CSV /folder2/
done
But when processed, all the rows are concatenated to one row, like this:
1 AAA BBB 2 CCC DDD
What can be wrong with the script?