LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 02-23-2011, 12:26 PM   #1
CodyK479
LQ Newbie
 
Registered: Feb 2011
Location: Bentonville, AR
Distribution: Ubunto, Knoppix
Posts: 18

Rep: Reputation: 0
Parsing output; End of file option?


Hello. Hope this is the right thread. I don't see a bash or script writing one. And this seems too simple for the programming thread.

I'm working on a alias/script that will make it easier to look at my environment via the set command.

On my ubunto when running set it also displays some 10 pages of code pertaining to something called "imagemagik".
at the end of the output. This code begins with the { character.

This is annoying if I want to look at my environment when working on scripts. How could I use something like grep, awk, sed, or whatever to ignore everything after the "{" character.

That seems to be the simplest way as long as there are no leading brackets in my environment. (And if you're thinking I should just remove {imagemagik}, I might just do that. But I still would like to know how to do this).

Thanks in advance,
James
 
Old 02-23-2011, 05:53 PM   #2
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,411

Rep: Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873
Maybe something like:
Code:
set | sed '/{/,$ d'
 
Old 02-23-2011, 06:46 PM   #3
kurumi
Member
 
Registered: Apr 2010
Posts: 223

Rep: Reputation: 45
Code:
set | ruby -0777 -le 'print gets.split(/{/)[0]'
 
Old 02-23-2011, 09:13 PM   #4
CodyK479
LQ Newbie
 
Registered: Feb 2011
Location: Bentonville, AR
Distribution: Ubunto, Knoppix
Posts: 18

Original Poster
Rep: Reputation: 0
thanks
 
  


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
newbie needs coding help--either parsing err or invalid $END cflores59 Linux - Newbie 2 02-16-2011 12:38 PM
[SOLVED] Is getent a better option than parsing the /etc/passwd file through while loop vinaytp Linux - Newbie 15 07-14-2010 10:18 AM
gunzip complains "Unexpected End-of-file" when C prog's output is fed to it in bash daton007 Linux - Software 1 06-13-2009 01:09 PM
Are results sent to an output file only at the end of a command sequence? Zebe Linux - Newbie 2 03-19-2009 06:34 PM
Can I redirect script output to a file without ">> $LOGFILE" at the end of each line davee Linux - General 1 12-19-2003 05:01 AM


All times are GMT -5. The time now is 05:12 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.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration