LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 08-05-2003, 10:53 AM   #1
SchwipSchwap
Member
 
Registered: Aug 2002
Distribution: Suse8.0, Mandrake, Knoppix
Posts: 92

Rep: Reputation: 15
Talking need help with grep


hi! i have following print:

-------------------------------------------------------------------------------------
tcprobe -i test.avi
[tcprobe] RIFF data, AVI video
[avilib] V: 25.007 fps, codec=DIVX, frames=122565, width=576, height=256
[avilib] A: 44100 Hz, format=0x55, bits=0, channels=2, bitrate=102 kbps,
[avilib] 187626 chunks, 63030979 bytes
[tcprobe] summary for test.avi, (*) = not default, 0 = not detected
import frame size: -g 576x256 [720x576] (*)
frame rate: -f 25.007 [25.000] frc=0 (*)
audio track: -a 0 [0] -e 44100,0,2 [48000,16,2] -n 0x55 [0x2000] (*)
bitrate=102 kbps
length: 122565 frames, frame_time=39 msec
---------------------------------------------------------------------------------------
i want to grep only the "122565"

tcprobe -i test.avi | grep length

greps the hole line

Thx for help
SchwipSchwap
 
Old 08-05-2003, 12:26 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 68
You will need to use cut or awk:
tcprobe -i test.avi | grep length | cut -d" " -f2
tcprobe -i test.avi | grep length | awk {'print $2'}
 
Old 08-05-2003, 12:38 PM   #3
SchwipSchwap
Member
 
Registered: Aug 2002
Distribution: Suse8.0, Mandrake, Knoppix
Posts: 92

Original Poster
Rep: Reputation: 15
THX for help solved the problem with following script:

------------------------------------------------------------------------------------
tcprobe -i "$*" > movieinfo.tmp

FRAMES=`grep '\[avilib\] V:' movieinfo.tmp | \
perl -e ' $line=<STDIN> ; $line =~ /frames=(\d+)/ ; print $1' `

MIN_TOTAL=`echo "scale=0 ; ($FRAMES / 1440)"| bc -l`

echo $MIN_TOTAL

rm movieinfo.tmp -f
-----------------------------------------------------------------------------------

script prints movielenght in min
 
Old 08-05-2003, 01:47 PM   #4
SchwipSchwap
Member
 
Registered: Aug 2002
Distribution: Suse8.0, Mandrake, Knoppix
Posts: 92

Original Poster
Rep: Reputation: 15
shit script works only with avi files not with mpg
anybody knowing a programm printing movielength of all movies?
 
Old 08-06-2003, 12:24 PM   #5
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 68
Try mplayer.
 
Old 08-08-2003, 07:08 AM   #6
SchwipSchwap
Member
 
Registered: Aug 2002
Distribution: Suse8.0, Mandrake, Knoppix
Posts: 92

Original Poster
Rep: Reputation: 15
mplayer? how?
 
  


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
grep ?? can grep us variables? DaFrEQ Linux - Software 4 09-14-2005 12:22 PM
help on grep!!!! sanjith11 Programming 5 01-20-2005 05:43 PM
What does rpm -qa |grep th* (as compared to rpm -qa |grep th) display? davidas Linux - Newbie 2 03-18-2004 01:35 AM
"Undeleting" data using grep, but get "grep: memory exhausted" error SammyK Linux - Software 2 03-13-2004 03:11 PM
ps -ef|grep -v root|grep apache<<result maelstrombob Linux - Newbie 1 09-24-2003 11:38 AM

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

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