Hello, I need help. I have to sort information from a file and place into excel
I no that I have use a shell with the cmds 'grep' and 'sed' but unsure how to go about it
The file looks like this:
26/10/01 686856 70.00
26/10/01 STANDING ORDER 1301.25
27/10/01 686849 580.00
28/10/01 653937 21.00
29/10/01 653938 20.00
29/10/01 686855 76.72
29/10/01 DIRECT DEBIT 10.00
29/10/01 DIRECT DEBIT 44.00
29/10/01 STANDING ORDER 23.00
I have to sort it in to 3 columns
Date, description and money
Any help would be great thx
Configuration: Windows XP Internet Explorer 7.0
Hi
sed 's/G O/G_O/g' data.txt > data_mod.txt sed 's/T D/T_D/g' data_mod.txt > data.txt rm data_mod.txtThen you really have 3 columns and you can extract them with awk for example, it is : cat data.txt | awk -F " " '{print $1}' > column1.txt
cat data.txt | awk -F " " '{print $2}' > column2.txt
cat data.txt | awk -F " " '{print $3}' > column3.txt At last, you can modify the second file column2.txt to have the second column like it was :
sed 's/G_O/G O/g' column2.txt > column2_mod.txt sed 's/T D/T_D/g' column2_mod.txt > column2.txt rm column2_mod.txtIs it more or less what you wanted to do ? See you ! You'd better close your eyes, bow your head And wait for the ricochet |
Hi, [tmpfs]$ cat file.txt 26/10/01 686856 70.00 26/10/01 STANDING ORDER 1301.25 27/10/01 686849 580.00 28/10/01 653937 21.00 29/10/01 653938 20.00 29/10/01 686855 76.72 29/10/01 DIRECT DEBIT 10.00 29/10/01 DIRECT DEBIT 44.00 29/10/01 STANDING ORDER 23.00 [tmpfs]$ sed 's/ /,/1;s/\(.*\) \(.*\)/\1,\2/' file.txt 26/10/01,686856,70.00 26/10/01,STANDING ORDER,1301.25 27/10/01,686849,580.00 28/10/01,653937,21.00 29/10/01,653938,20.00 29/10/01,686855,76.72 29/10/01,DIRECT DEBIT,10.00 29/10/01,DIRECT DEBIT,44.00 29/10/01,STANDING ORDER,23.00 [tmpfs]$;-)) $ man woman Il n'y a pas de page de manuel pour woman. |