Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


Search this Thread
Old 06-15-2005, 05:47 AM   #1
Registered: Mar 2005
Location: berlin
Distribution: Redhat 9, Fedora 3
Posts: 70

Rep: Reputation: 15
how to pipe and parse output of a command

if the output of a command is e.g. "HEIGHT=1 WIDTH=14 COLOR=red SIZE=23" how can "pipe and parse" so that I get this output in a file:

something like:
thecommand | replace(" ","\n") > output.txt

Old 06-15-2005, 05:53 AM   #2
Registered: Jan 2005
Location: India
Distribution: RHEL,CentOS,SUSE,Solaris10
Posts: 183

Rep: Reputation: 31

command > output_file

hereoutput will stored in output_file

command > output_file 2> error_file
Here, stdout goes to output_file while anything written to stderr goes to error_file.
Old 06-15-2005, 05:55 AM   #3
Registered: Nov 2003
Location: Bristol, UK
Distribution: Debian Lenny, Gentoo (at work)
Posts: 388

Rep: Reputation: 32
That doesn't add the newlines though, which from the look of it is the key thing. Try:

command | tr " " "\n" > output.txt


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
how to pipe output from make BBB Programming 2 05-20-2005 07:14 AM
pipe xine output to file sohmc Linux - Software 0 01-01-2005 11:03 PM
parse output ky-lab_rat Linux - Newbie 7 01-23-2004 02:47 PM
Read the output from a pipe with bash ? fluppi Linux - Software 3 01-13-2004 01:59 PM
Output truncated when using pipe tells Linux - General 1 12-16-2003 09:06 PM

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration