|
Hi Peter,
when using this command I get the error :
qsh: 001-0085 : Too many arguments specified on command
regards
Guy Geboers
Europe ICT System & Application Administrator
Sibelco Europe
De Zate 1•BE-2480 Dessel
tel. +32 14 83 72 80
Guy.Geboers@xxxxxxxxxxx
www.sibelco.be
SCR-SIBELCO NV - Maatschappelijke zetel - Siège social - Registered
Office: Plantin en Moretuslei 1A - BE-2018 Antwerpen
RPR Antwerpen - BTW BE 0 404 679 941 - ING IBAN BE38 3200 0042 7072
From: Peter Dow <petercdow@xxxxxxxxx>
To: midrange-l@xxxxxxxxxxxx
Date: 22/01/2012 22:09
Subject: Re: Search in content of a IFS file
Sent by: midrange-l-bounces@xxxxxxxxxxxx
Hi Guy,
From http://ss64.com/bash/grep.html
"Normally, exit status is 0 if matches were found, and 1 if no matches
were found (the `-v' option inverts the sense of the exit status).Exit
status is 2 if there were syntax errors in the pattern, inaccessible
input files, or other system errors."
The syntax being used in this case is
grep search-string files-to-search
Knowing that, and that Unix considers everything a file, including
directories, the command I gave told it to search only the file named
"Output" which happens to be a file with content that happens to be
directory entries. So instead of searching the content of the files in
the Output folder, it searched the directory entries, and didn't find
anything.
To make it search the content of the files in the Output folder, we need
to specify the names of those files, and that specification can be
generic. Try this:
QSH CMD('grep 110000890 /M3BE/env/PRD/Output/*')
I'm not sure why you didn't see anything. When I ran it, I got the
following, because I do not have any of those folders:
grep: 001-2113 Error found getting information for object
/M3BE/env/PRD/Outpu
t/*. No such path or directory.
Press ENTER to end terminal session.
--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
pdow@xxxxxxxxxxxxxxx <mailto:pdow@xxxxxxxxxxxxxxx> /
On 1/22/2012 10:47 AM, Guy Geboers wrote:
Hi Peter,cellspacing="1"
when I execute the command from an OS400 line, I only get the message
"Command ended normally with exit status 1", nothing else
Guy
From: Peter Dow<petercdow@xxxxxxxxx>
To: midrange-l@xxxxxxxxxxxx
Date: 18/01/2012 23:18
Subject: Re: Search in content of a IFS file
Sent by: midrange-l-bounces+guy.geboers=sibelco.com@xxxxxxxxxxxx
Or from an OS400 command line:
QSH CMD('grep 110000890 /M3BE/env/PRD/Output')
On 1/18/2012 6:23 AM, Michael Ryan wrote:
That example showed looking for the string 'table' in all the .phpwrote:
files in directory /home/michael. the output of the command shows the
name of the file '/home/michael/dspcust.php:' and the line containing
the search string '// Put the results in an HTML table'. There are
multiple results.
You would do this:
grep 110000890<files in which to search>
Files in the IFS may or may not have extensions, just like Windows or
*NIX files.
On Wed, Jan 18, 2012 at 9:19 AM, Guy Geboers<Guy.Geboers@xxxxxxxxxxx>
Hi,
When I use this statement nothing happens.
I even wonder if files in the IFS of an iSeries have extensions (?)
And can you please give me an example on how to search for a specific
string in the content of the file (so not in the filename itself) ?
Thanks a lot.
Guy
From: Michael Ryan<michaelrtr@xxxxxxxxx>
To: Midrange Systems Technical Discussion<midrange-l@xxxxxxxxxxxx>
Date: 18/01/2012 15:04
Subject: Re: Search in content of a IFS file
Sent by: midrange-l-bounces@xxxxxxxxxxxx
Use grep in QSH.
grep: 001-3010 usage: grep [-E | -F] [-c | -l | -q] [-ihnsvwxy] [-e
pattern_list] [-f pattern_file] [pattern] [file ...]
Like...
grep table /home/michael/*.php/home/michael/dspcust.php:<table width="75%" border="1"
mailingquerycellp
adding="1" bgcolor="#eeeeee">
/home/michael/dspcust.php:print("<b>The result of the ADDRFILE table
queryis
:</b>\n");
/home/michael/dspcust.php:// Put the results in an HTML table
/home/michael/dspcust.php:</table>
/home/michael/dspsum.php:<table width="75%" border="1" cellspacing="1"
cellpa
dding="1" bgcolor="#eeeeee">
/home/michael/dspsum.php:print("<b>The result of the ADDRFILE table
is:
</b>\n");
/home/michael/dspsum.php:// Put the results in an HTML table
/home/michael/dspsum.php:</table>
$
You can redirect the output to a file if you want...
grep table /home/michael/*.php> /home/michael/myfile.txtOn Wed, Jan 18, 2012 at 5:02 AM, Guy Geboers<Guy.Geboers@xxxxxxxxxxx>
wrote:
Hi,
In an IFS directory e.g. /M3BE/env/PRD/Output there are thousands of
files.
I need a list of all files which have the string "110000890" in their
content
Who can help me ?
thanks
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
--listlist
To post a message email: MIDRANGE-L@xxxxxxxxxxxx--
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.