LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-07-2004, 04:22 PM   #1
ridertech
Member
 
Registered: Dec 2003
Location: Seattle, Washington
Distribution: Debian 'Sarge'
Posts: 85

Rep: Reputation: 15
AWK: print field to end, and character count?


I originally kept my iTunes music updated from a Windows machine, but recently moved everything to a network storage device so that all my computers have access to the music. Due to Mac's file naming limitations, I need to fix the files that have a name longer than 34 (or is it 31?) characters.

I got the listing for every .mp3 file using...
ls -al /music/iTunes/iTunes Music/*/* | grep .mp3 > itunes

There are two more steps I'd like to take, but getting stuck... Using that itunes file, I want to output everything from the ninth field to the end. Then, I'd also like to add a character count at the end.
 
Old 05-07-2004, 05:07 PM   #2
ridertech
Member
 
Registered: Dec 2003
Location: Seattle, Washington
Distribution: Debian 'Sarge'
Posts: 85

Original Poster
Rep: Reputation: 15
awk - printing field to end

For future reference, here is how to print out from a specific field to the end of the line...

If your input file is like this...
testfile 23#1212 test.report 11/12/01 this is ofcourse my comment

Then...
awk '{print substr($0, index($0,$5)) }' input_file

Will print out...
this is ofcourse my comment

Solution found here...
http://forums1.itrc.hp.com/service/f...hreadId=121473
 
  


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
quick hand with awk multiple field separators pld Programming 10 05-28-2010 07:51 AM
Multiple Field Seperators in Awk... TheDarktrooper Programming 6 05-06-2004 04:50 AM
My field separator changes when using awk Helene Programming 3 05-01-2004 08:10 AM
Two field seperators in awk?? Astro Programming 2 11-09-2003 10:12 AM
count bytes with awk alaios Linux - General 8 05-13-2003 06:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:02 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