LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-05-2010, 10:43 AM   #1
keenboy
Member
 
Registered: Jan 2008
Location: Cullompton
Distribution: Kubuntu
Posts: 36

Rep: Reputation: 15
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,
 
Old 08-05-2010, 11:34 AM   #2
kbgreen72
LQ Newbie
 
Registered: Jan 2009
Posts: 2

Rep: Reputation: 0
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
split very large 200mb text file by every N lines (sed/awk fails) doug23 Programming 8 08-10-2009 06:08 PM
How to use split function with AWK command? intikhabalam Linux - General 4 07-29-2008 10:40 AM
awk command to split file Hebron Linux - Newbie 3 08-27-2007 07:35 PM
How to split file , .. awk or split ERBRMN Linux - General 9 08-15-2006 12:02 AM
awk/gawk/sed - read lines from file1, comment out or delete matching lines in file2 rascal84 Linux - General 1 05-24-2006 09:19 AM


All times are GMT -5. The time now is 01:30 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration