- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shell script help needed.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 07:24 PM
06-21-2004 07:24 PM
Shell script help needed.
Hi,
my requirement, I have multiple files .Now i want to read each line of each file.; and do the following grep in each line one after another.
grep -h 'APPLNAME= MAESTRO=' $LINE
grep -h 'ls:BEGIN' $LINE
grep -h 'ds:END' $LINE
end.
how can i do that.
Can anyone help...
regards,
Sunil.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 07:26 PM
06-21-2004 07:26 PM
Re: Shell script help needed.
I think you are more specific about your requirements, we might be able to do what you want without ging through line by line and doing a grep. That way is really slow.
Let us know what you really want:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 07:33 PM
06-21-2004 07:33 PM
Re: Shell script help needed.
from the files line by line and save it in a file in that order. In short i want to
record the application name and start and end time from the log files to a different
file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 07:34 PM
06-21-2004 07:34 PM
Re: Shell script help needed.
for i in `ls`
do
grep -h "search string" $i
done
sks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 07:37 PM
06-21-2004 07:37 PM
Re: Shell script help needed.
the ls argument gives me file wise i want line wise .i.e line by line for say four diff. files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 07:47 PM
06-21-2004 07:47 PM
Re: Shell script help needed.
for i in `ls`
do
for j in `cat $i`
do
grep -h "search string" $j
done
done
sks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 08:36 PM
06-21-2004 08:36 PM
Re: Shell script help needed.
you could do this:
for i in `ls`
do
while read line
do
grep "pattern"
some more operation
done < $i
done
Hope this fits your requirement.
manish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2004 07:29 AM
06-23-2004 07:29 AM
Re: Shell script help needed.
Sunil,
If by $LINE you mean each line of each file, then you could change $LINE to FILE_PATTERN (e.g., 2004_Jun*.log), and change this:
grep -h 'APPLNAME= MAESTRO=' $LINE
grep -h 'ls:BEGIN' $LINE
grep -h 'ds:END' $LINE
to this:
grep -h -e 'APPLNAME= MAESTRO=' -e 'ls:BEGIN' -e 'ds:END' FILE_PATTERN
Does that help?