LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   why does AWK split my lines into two? (https://www.linuxquestions.org/questions/linux-general-1/why-does-awk-split-my-lines-into-two-824391/)

keenboy 08-05-2010 10:43 AM

why does AWK split my lines into two?
 
Hi,

when I run the following command:

awk -F\, '{print $10 "," $5 "," $1 "," $3 "," $4 "}' myfile > tmpfile

tmpfile displays the lines but they are all cut off and placed on the line below at the same point.

Is there any reason why?

Many Thanks,

kbgreen72 08-05-2010 11:34 AM

Don't know if it was just a typo or not. But if you remove the " (double quote char) just before the closing }, it works as expected on my system.

$cat myfile
l1w1,l1w2,l1w3,l1w4,l1w5,l1w6,l1w7,l1w8,l1w9,l1w10
l2w1,l2w2,l2w3,l2w4,l2w5,l2w6,l2w7,l2w8,l2w9,l2w10

becomes

$cat tmpfile
l1w10,l1w5,l1w1,l1w3,l1w4
l2w10,l2w5,l2w1,l2w3,l2w4


All times are GMT -5. The time now is 03:36 AM.