The time now is 07/25/08 - 01:29
Log in: Username: Password:
Search forums for:
  

Random Linux Question

Post new topic   Reply to topic
Author Message
Cardnyl
Luke Warm
Luke Warm


Joined: 18 Jan 2004
Posts: 397
Location: FL



PostPosted: 02/10/06 - 16:46    Post subject: Random Linux Question Reply with quote

Any linux-savy people out there familiar with the command line to grep a specific string from a linux man file and then pipe the result someplace else.

I tried the following and it didn't work but it should give you an idea of what Im trying to do.

man awk 2> temp.txt | grep "{print}" | less

Command tries to open the manual for the command awk, dump the standard output to a file called temp, pipe the contents of the file to grep excluding what doesnt match the string in quotes, and redirecting that to less.

If this isnt possible is there any way to search through a multi page manual file for a specific string on a command line interface?

Thanks in advance.
Back to top
sinrakin
RealPoor Master of Posts
RealPoor Master of Posts


Joined: 11 Oct 2002
Posts: 7044



PostPosted: 02/10/06 - 17:00    Post subject: Reply with quote

I'm not 100% sure what you're trying to do. What's the purpose of the file temp.txt? You can't "pipe" a file; you can only pipe the output of a command.

It seems like all you really want is
man awk | less

then while you're in less, type
/print
or whatever, to jump to the first/next occurrence of that string so you can see the context around it?
Back to top
The biggest online universe needs another star!
Maybe you are the one!?
» Enter the large universe of Anarchy Online and find out! «
kemble
RealPoor Sensei
RealPoor Sensei


Joined: 14 Oct 2002
Posts: 1912
Location: MI



PostPosted: 02/10/06 - 17:24    Post subject: Reply with quote

sinrakin wrote:
I'm not 100% sure what you're trying to do. What's the purpose of the file temp.txt? You can't "pipe" a file; you can only pipe the output of a command.

It seems like all you really want is
man awk | less

then while you're in less, type
/print
or whatever, to jump to the first/next occurrence of that string so you can see the context around it?


Seems to be what he would need.
Back to top
motherface
RealPoor Guru
RealPoor Guru


Joined: 12 Mar 2003
Posts: 3407



PostPosted: 02/10/06 - 17:50    Post subject: Reply with quote

You can search within the "man" program by typing the / key.
Back to top
Cardnyl
Luke Warm
Luke Warm


Joined: 18 Jan 2004
Posts: 397
Location: FL



PostPosted: 02/10/06 - 17:53    Post subject: Reply with quote

sinrakin wrote:
I'm not 100% sure what you're trying to do. What's the purpose of the file temp.txt? You can't "pipe" a file; you can only pipe the output of a command.

It seems like all you really want is
man awk | less

then while you're in less, type
/print
or whatever, to jump to the first/next occurrence of that string so you can see the context around it?


That is exactly what I was trying to do. Guess I was trying to make it more complicated than it was. I also forgot about the piping thing with regards to files.

I had to go through the man file for less a bit to find out how to search for { print }. I ended up needing to do /^R but either way thats exactly what i was seeking. Thanks again Razz
Back to top
Display posts from previous:   
Post new topic   Reply to topic
Page 1 of 1

Related topics:
TV-out question
Car question
Question bout Multi-Classing
Windows XP question
Question about equip upgrade in Lineage 2
Age of Conan clothing question
Question about Underworld Trailer Music
N00Best of all questions :P
Domain Name Registration question...
Question on Transfering toons off Wow accounts
Question about the D&D Online raid
DVD Burner Question
Question about Lineage 2 Subclasses and Race
Duo Question
Lineage 2 monthy payment question
Blizzard job question!
Hey video editing people! Question for you.
Stupid Math Question
Warhammer Online Capital City question
Question about Warhammer Online Rare items

 





Warning: fopen(/home/sites/realpoor.com/htdocs/test_cache/Random_Linux_Question_t43523.html) [function.fopen]: failed to open stream: No such file or directory in /home/sites/realpoor.com/htdocs/includes/page_tail.php on line 171

Warning: fwrite(): supplied argument is not a valid stream resource in /home/sites/realpoor.com/htdocs/includes/page_tail.php on line 172

Warning: fclose(): supplied argument is not a valid stream resource in /home/sites/realpoor.com/htdocs/includes/page_tail.php on line 173