11-09-2008
grep display word only
Folks, is it possible to display only words with grep (or any built-in ultility)?
I have more than 1 pattern to search, say
apple &
orange
The text goes like this:
Quote:
tasty apple-bite orange-juice fruit
orange-skin fruit apple-red
So I need to display all the words starting with
apple or
orange
The output should be:
Quote:
apple-bite
orange-juice
orange-skin
apple-red
Any idea?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I need idea about this, say I have this line:
05 21 * * 0,6 /user/clean.desktop.sh > /tmp/desktop_rpt 2>&1
I would need to grep the word desktop and display the /user/clean.desktop.sh and not the whole line. And if I have some more lines say,
05 21 * * 0,6 /user/clean.desktop.sh >... (1 Reply)
Discussion started by: Orbix
1 Replies
2. UNIX for Dummies Questions & Answers
Hi,
When we "grep" for a word in a file, it returns the lines containing the word that we searched for. Is there a way to display only the words and not the entire line containing them.
Thanks
Ananth (6 Replies)
Discussion started by: ananthmm
6 Replies
3. Shell Programming and Scripting
Hi Guru's.... I've one log file in all my systems which writes the backup information..
I'have written a command like this:
ssh -l ora${sid} ${primaryhost} "tail -50 /oracle/$ORACLE_SID/newbackup/END_BACKUP.log" |grep 'insert' |tail -1| awk '{print $7}'
We have nearly 50 systems in our... (2 Replies)
Discussion started by: suri.tyson
2 Replies
4. UNIX for Dummies Questions & Answers
hi, consider the below line in a text file,
'Y',getdate(),'N','V',NULL .....
'N',getdate(),'Y','D',NULL .....
'Y','N','Y',getdate(),'Y','D',NULL ....
as u see above, i want only the second word after the getdate() word...
getdate() will not come 2nd word alwys it may be any position but i... (11 Replies)
Discussion started by: prsam
11 Replies
5. Shell Programming and Scripting
Hi guys.
I am trying to perform a search using grep. I get my grep to work, but need to "awk" a Process Number that is 2 lines above...
Example:
I run a query on my TSM server for Processes that are "Waiting" for something...it returns this:
Process Number: 32,881
Process... (14 Replies)
Discussion started by: Stephan
14 Replies
6. Shell Programming and Scripting
ok, so this is proving to be kind of difficult even though it should not be.
say for instance I want to grep out ONLY the word fkafal from the below output, how do I do it?
echo ajfjf fjfjf iafjga fkafal foeref afoafahfia | grep -w "fkafal"
If i run the above command, i get back all the... (4 Replies)
Discussion started by: SkySmart
4 Replies
7. Shell Programming and Scripting
Hi all,
FileOne
family balance >>>>>
0 0
0 0
java.io.FileNotFoundException: Settings.xml (No such file or directory)
at java.io.FileInputStream.open(Native Method)
..
....
.....
.....
java.lang.NullPointerException
...
.....
......
Stacktrace:
at... (2 Replies)
Discussion started by: linuxadmin
2 Replies
8. Shell Programming and Scripting
Hi,
Below is an example :
ST1 PREF: int1 AVAIL: int2
ST2 PREF :int1 AVAIL: int2
I need int1 to come in preferred variable while programming and int2 in available variable
Please help me doing so
Best regards,
Vishal (10 Replies)
Discussion started by: Vishal_dba
10 Replies
9. Shell Programming and Scripting
Hi,
I wanted to grep string "ERROR" and "WORNING" after last occurrence of String "Starting" only and wanted to display two lines after searched ERROR and WORNING string and one line before. I have following cronjob log file "errorlog" file and I have written the code for same in Unix as below... (17 Replies)
Discussion started by: nes
17 Replies
10. Shell Programming and Scripting
Hi,
When we "grep" for a word in a file, it returns the last lines containing the word that we searched for.
Is there a way to display last line to grep.
Thanks
Ex log.
Ex. logname.log
2015-07-29 06:43:07.023|BETA |2015-07-29... (5 Replies)
Discussion started by: ooilinlove
5 Replies