LinuxQuestions.org
Social Bookmarking all things Linux and Open Source
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This 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
 
Thread Tools Search this Thread
Old 05-07-2004, 05:22 PM   #1
ridertech
Member
 
Registered: Dec 2003
Location: Seattle, Washington
Distribution: Debian 'Sarge'
Posts: 85
Thanked: 0
AWK: print field to end, and character count?


[Log in to get rid of this advertisement]
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.
ridertech is offline     Reply With Quote
Old 05-07-2004, 06:07 PM   #2
ridertech
Member
 
Registered: Dec 2003
Location: Seattle, Washington
Distribution: Debian 'Sarge'
Posts: 85
Thanked: 0

Original Poster
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
ridertech is offline     Reply With Quote

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


All times are GMT -5. The time now is 04:37 PM.

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.
Advertisement
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Click Here to receive a complimentary subscription courtesy of LQ.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration