LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-03-2008, 09:17 PM   #1
jchambers
Member
 
Registered: Aug 2007
Location: California
Distribution: Debian
Posts: 127

Rep: Reputation: 15
Unknown character to usable text format


Hello all.

Well I was not quite sure how label this thread...

Using SSH connection.
I am running and application and having it write the screen output to a file.
Here are examples of what is happening.

/usr/local/bin/mplayer $1 -vf cropdetect=48:16 -frames 90 1>/srv/process/video.crop

Result:
Code:
A:   0.3 V:   0.0 A-V:  0.350 ct:  0.000   0/  0 ??% ??% ??,?% 1 0
A:   0.4 V:   0.0 A-V:  0.327 ct:  0.002   0/  0 ??% ??% ??,?% 2 0
Can someone explain why it is formatted like this?


If I view it on screen:
Code:
[CROP] Crop area: X: 0..1439  Y: 0..1079  (-vf crop=1440:1072:0:4).
[CROP] Crop area: X: 0..1439  Y: 0..1079  (-vf crop=1440:1072:0:4).
Next I tried:
echo "`/bin/cat /srv/process/video.crop | grep crop=`" > /srv/process/video.crop

Result:
Code:
A:   0.1 V:   0.0 A-V:  0.024 ct:  0.002   0/  0 ??% ??% ??,?% 0 0
[CROP] Crop area: X: 0..1439  Y: 0..1079  (-vf crop=1440:1072:0:4).

A:   0.1 V:   0.1 A-V:  0.025 ct:  0.004   0/  0 ??% ??% ??,?% 0 0
[CROP] Crop area: X: 0..1439  Y: 0..1079  (-vf crop=1440:1072:0:4).

Which is closer but not what I want.

My goal is the end up with just: crop=1440:1072:0:4
sed is does not seem to be responding to the file I have created.

Tried:
/bin/sed -i 's/[^0-9=:]*//' /srv/process/video.crop
/bin/sed -i 's/A\:.*?crop//' /srv/process/video.crop

No results.
Any help would be great.

Jon
 
Old 08-04-2008, 12:04 AM   #2
jchambers
Member
 
Registered: Aug 2007
Location: California
Distribution: Debian
Posts: 127

Original Poster
Rep: Reputation: 15
[solved]

Ok I figured it out.

Thank you all for looking at the post.
I was mistaken that sed would not work...

Here is the solution.


/bin/sed -i 's/.*crop=//' /srv/process/video.crop
/bin/sed -i 's/[^0-9:].*//' /srv/process/video.crop

result: 1440:1072:0:4

Jon
 
  


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
ffmpeg x11grab unknown format /y0shi Slackware 10 09-30-2009 04:16 PM
How to store text(strings) in a 2D character array reading from a text file(C++) bewidankit Programming 3 02-14-2008 07:08 AM
Replace text of unknown content with other text in file brian0918 Programming 15 07-14-2005 09:22 PM
Replace text of unknown content with other text in file brian0918 Linux - Software 1 07-14-2005 03:22 PM
Reverse and Squeezing of text of character in C egoleo Programming 1 03-19-2004 09:45 AM


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

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.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration