12-24-2007
grep a word and display its column
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 > /tmp/desktop_rpt 2>&1
05 21 * * 0,6 /user/clean.laptop.sh || /user/view.desktop.sh > /tmp/view_rpt 2>&1
05 21 * * 0,6 /user/a.sh || /user/desktop.sh > /tmp/view_rpt 2>&1
It will display:
/user/clean.desktop.sh
/user/view.desktop.sh
/user/desktop.sh
Field separator is the white space.
Any idea how?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi,
how to print a row which contains a perticular word in its third column using grep, cut,
or any thing else.
thanks (2 Replies)
Discussion started by: useless79
2 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. Shell Programming and Scripting
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:
So I need to display all the words starting with apple or orange
The output should be:
Any idea? (7 Replies)
Discussion started by: bsddaemon
7 Replies
5. 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
6. 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
7. Shell Programming and Scripting
Hi,
I have input file as below. Can you help me?
inac_4y;0;2;Balance;200;1;1;
0;2;Balance;100;1;
0;inac_nq;0;1;Balance;100;1
desired output
Balance;200
Balance;100
Balance;100
-Suresh
Please use and tags when posting code, data or logs etc. to preserve formatting... (5 Replies)
Discussion started by: suresh3566
5 Replies
8. 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
9. 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
10. UNIX for Beginners Questions & Answers
I have a multicolumn text file with header in the first row like this
The headers are stored in an array called . which contains I want to search for each elements of this array from that multicolumn text file. And I am using this awk approach
for ii in ${hdr}
do
gawk -vcol="$ii" -F... (1 Reply)
Discussion started by: Atta
1 Replies
LEARN ABOUT REDHAT
vncserver
VNCSERVER(1) General Commands Manual VNCSERVER(1)
NAME
vncserver - start a VNC server application
SYNOPSIS
vncserver
[:number] [-geometry widthxheight] [-depth depth] [-pixelformat rgbNNNbgrNNN] [-name desktop-name] [Xvnc-options...]
vncserver -kill :number
DESCRIPTION
Start (or stop) a VNC session. This is a VNC (Virtual Network Computing) server. With vncserver you can start a computing desktop envi-
ronment that you wish to be able to use from a different machine.
OPTIONS
:number
The display number to use. If omitted, the next free display number is used.
-geometry widthxheight
The session is to be of the specified size.
-depth depth
The colour depth of the visual to provide (bits per pixel).
-pixelformat rgbNNNbgrNNN
The colour representation bit allocations to use.
-name desktop-name
The name to give the desktop.
-kill :number
Stop the session running on display number.
SEE ALSO
vncviewer(1), Xvnc(1), vncpasswd(1), vncconnect(1)
AUTHOR
AT&T Laboratories Cambridge
Man page by Tim Waugh <twaugh@redhat.com>
6 Nov 2000 VNCSERVER(1)