Reputation: 1
I have one script which is running and giving an csv file as output in the below format
25-02-2013
RJ
D204349194
Pagamento Caixa 0
256.31 -256.31
But i need to align in the below format :
25-02-2013 RJ D244728244 Pagamento Banco Brasil 0 403.25 -403.25
Means like in excel it should be divided into columns
please suggest me
Upvotes: 0
Views: 1570
Reputation: 212238
awk '{$1=$1; printf $0 " "}' input; echo
The $1=$1
squeezes whitespace on each line, and the echo
emits a terminating newline.
Upvotes: 0
Reputation: 274562
First use tr
to pull everything onto a single line and then use sed
to split the single line based on a field.
Try the following:
tr '\n' '\t' < file | sed -r 's/([0-9]{2}-[0-9]{2}-[0-9]{4})/\n\1/g'
This assumes that:
dd-MM-yyyy
Upvotes: 0
Reputation: 195039
if you have column
installed, try this line:
awk '{printf $0}' file|column -t
for your example:
kent$ cat file
25-02-2013
RJ
D204349194
Pagamento Caixa 0
256.31 -256.31
kent$ awk '{printf $0}' file|column -t
25-02-2013 RJ D204349194 Pagamento Caixa 0 256.31 -256.31
Upvotes: 1