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 DEBIAN
desktop-file-validate
DESKTOP-FILE-VALIDATE(1) General Commands Manual DESKTOP-FILE-VALIDATE(1)
NAME
desktop-file-validate - Validate desktop entry files
SYNOPSIS
desktop-file-validate [--no-warn-deprecated] [--warn-kde] FILE...
DESCRIPTION
The desktop-file-validate program is a tool to validate desktop entry files according to the Desktop Entry specification 1.0.
The specification describes a file format to provide information such as name, icon and description for an application. Such a file can
then be used as an application launcher and to display the application in the applications menu.
For information about the Desktop Entry specification, see http://freedesktop.org/wiki/Specifications/desktop-entry-spec.
The desktop entry files are commonly called desktop files.
OPTIONS
The following options are supported:
--no-warn-deprecated
Do not warn about usage of deprecated items that were defined in previous versions of the specification.
--warn-kde
Warn about usage of KDE extensions to the specification. This includes the use of the KDE Desktop Entry group, of the ServiceTypes,
DocPath, Keywords, InitialPreference, Dev, FSType, MountPoint, ReadOnly, UnmountIcon keys, or of the Service, ServiceType and FSDe-
vice types.
BUGS
If you find bugs in the desktop-file-validate program, please report these on https://bugs.freedesktop.org.
SEE ALSO
desktop-file-edit(1) desktop-file-install(1)
FREEDESKTOP.ORG DESKTOP-FILE-VALIDATE(1)