LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-07-2010, 06:57 PM   #31
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983

Quote:
Originally Posted by shakes82 View Post
I am getting a space after each ','
There is a typo in the pixellany's code:
Code:
-e 's/ /, /g'
should be
Code:
-e 's/ /,/g'
anyway, at this point you could try to figure it out, if you understand what these sed and awk statements do exactly. A little advice: pay always attention to the suggested code before actually run it and read carefully the related documentation to fully understand the algorithms. You can safely trust code posted by pixellany, druuna or me and many many other members here at LQ... but you never know!

Edit: ...and many many other members... grail being one of them.

Last edited by colucix; 07-07-2010 at 06:58 PM.
 
1 members found this post helpful.
Old 07-07-2010, 07:08 PM   #32
shakes82
LQ Newbie
 
Registered: Jun 2010
Posts: 21

Original Poster
Rep: Reputation: 15
Thanks grail. I understand what you are saying and I will learn this soon. I just needed to complete this work that is why needed help. Very soon I will be answering to questions on this forum.
I tried colucix command but it is giving me an error:
awk: ^syntax error. I copied the exact command. Please help. Thanks
 
Old 07-07-2010, 07:14 PM   #33
shakes82
LQ Newbie
 
Registered: Jun 2010
Posts: 21

Original Poster
Rep: Reputation: 15
Thanks everyone for your time and help. I have got the solution. Colucix, as I told grail....very soon you will find me answering to queries from newbies. I just needed to get this work done soon. Thanks again.
 
Old 07-07-2010, 07:49 PM   #34
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Well just something to cut your teeth on later, the following should be good for both formats you have shown us:
Code:
awk -F"[ /]" 'gsub(/:/,"");if(NF==4){var=$1;d=2}else var="20"$3 $1 $2;print var $(4-d),$(5-d),$(6-d),"SYM"}' OFS="," inputfile > outputfile
 
Old 07-07-2010, 11:12 PM   #35
shakes82
LQ Newbie
 
Registered: Jun 2010
Posts: 21

Original Poster
Rep: Reputation: 15
thanks grail!!!!!
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] awk, sed, grep and paragraphs ThinkLinux Linux - Newbie 3 04-09-2010 01:22 PM
help with grep/sed/awk nikunjbadjatya Programming 8 02-17-2010 07:29 PM
bash - awk, sed, grep, ... advice schneidz Programming 13 08-25-2008 09:30 AM
awk/sed to grep the text ahpin Linux - Software 3 10-17-2007 12:34 AM
diffrence between grep, sed, awk and egrep Fond_of_Opensource Linux - Newbie 3 08-18-2006 08:15 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration