LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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-24-2009, 05:27 PM   #1
freeindy
Member
 
Registered: Nov 2002
Posts: 205

Rep: Reputation: 30
AWK: delete last chars


Hi,

I have done a awk script that in has a variable called playlist in the following format:

Code:
{songname1,artist1,album1}, {songname2,artist1,album1}, ..., {songnameN,artistN,albumN},
In the END block I want to remove that last part ", " [commaSPACE].

Anyone knows?

Thanks
Indy
 
Old 07-24-2009, 09:16 PM   #2
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 241Reputation: 241Reputation: 241
use sub or gsub
Code:
gsub(/, $/,"",playlist)
 
Old 07-25-2009, 03:48 AM   #3
freeindy
Member
 
Registered: Nov 2002
Posts: 205

Original Poster
Rep: Reputation: 30
Thanks ghostdog74.

I should have realised from your previous input.
 
Old 07-25-2009, 05:35 AM   #4
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 241Reputation: 241Reputation: 241
what previous input.?
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Awk script - Converting newline chars sleeper0110 Programming 6 06-05-2009 07:50 PM
Error in replacing special chars using awk linux_vidhyarthi Linux - General 2 04-09-2008 08:39 PM
Sed, Awk, grep,Search,delete joyds219 Linux - Newbie 6 04-03-2008 07:15 AM
Delete lines using awk kkjegan Programming 13 09-11-2007 08:36 PM
(mc, samba, mplayer) delete 2 first chars in an argument Xa! Linux - Newbie 1 04-28-2004 03:45 AM


All times are GMT -5. The time now is 12:20 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration