- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Help with Unix Bourne Shell Script - Loop
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
Discussions
Discussions
Forums
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
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
тАО05-10-2001 01:32 PM
тАО05-10-2001 01:32 PM
I am trying to write a unix script to
read in the below file:
*************************************
AUTOSTUFFdsklfdskl
Date and Time
job definition change
owner:tom
jobname: report1
****************************************
AUTOSTUFFdsklflkdfkl
Date and Time
sendevent issued
owner:sally
jobname: report2
****************************
ETC...
I want my script to just report an output
file, like an audit report. I only want to
copy the information between the "******"
if the 3rd says "job definition changes", that's when I want to print all the info
between the "***********".
In other words, I don't care about the
sendevent issued stuff, so I don't want to
print that stuff between the "******".
I am having problems writing a shell script
to loop within the the "***********"
Thank You,
Laurie
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2001 07:28 PM
тАО05-10-2001 07:28 PM
Re: Help with Unix Bourne Shell Script - Loop
If it were me, I would do this in awk or perl. It's duck soup in those tools. If you like, when I get to the office in the morning I'll adapt one of my existing awk scripts during my coffee break. If you haven't whipped it by then if you attach a real sample of your input (so the pattern matching is exact) I think I can alter my script in under 5 minutes.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2001 04:08 AM
тАО05-11-2001 04:08 AM
Re: Help with Unix Bourne Shell Script - Loop
{ getline; l1=$0; getline ; l2=$0; getline; l3=$0; getline;getline; l5=$0; getline; l6=$0}
l3 ~ "job definition change" { print l1
print l2
print l3
print l5
print l6}' file
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2001 05:31 AM
тАО05-11-2001 05:31 AM
Re: Help with Unix Bourne Shell Script - Loop
--------------------------------------------
autosys2@droopy
05/07/2001 11:09:57
autotrack change
level: 1
::::::::::::::::::::::::::::::::::::::::::
AUTOSYS2@IFTCMSTR
05/07/2001 11:22:31
sendevent issued
eoid: ACEz10003652
job_name: CAP_BERG_BERGER
command: sendevent "-E" "FORCE_STARTJOB" "-P" "10"
::::::::::::::::::::::::::::::::::::::::::::::
AUTOSYS2@IFTCMSTR
05/07/2001 11:23:54
job definition change
job_name: MOO_FNBO_MON-3
box_name: MOO_FNBO_MON
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
AUTOSYS2@IFTCMSTR
05/07/2001 11:24:05
job definition change
job_name: MOO_FNBO_MON-4
box_name: MOO_FNBO_MON
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
AUTOSYS2@IFTCMSTR
05/07/2001 11:24:11
job definition change
job_name: MOO_FNBO_MON-E
box_name: MOO_FNBO_MON
::::::::::::::::::::::::::::::::::::::::::::::
AUTOSYS2@IFTCMSTR
05/07/2001 11:24:17
job definition change
job_name: MOO_FNBO_MON-E-NFY
box_name: MOO_FNBO_MON
:::::::::::::::::::::::::::::::::::::::::::::::
AUTOSYS2@IFTCMSTR
05/07/2001 11:24:23
job definition change
job_name: MOO_FNBO_MON-4-NFY
box_name: MOO_FNBO_MON
:::::::::::::::::::::::::::::::::::::::::::::::
AUTOSYS2@IFTCMSTR
05/07/2001 11:24:29
job definition change
job_name: MOO_FNBO_MON-3-NFY
box_name: MOO_FNBO_MON
@
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
AUTOSYS2@IFTCMSTR
05/07/2001 11:25:02
sendevent issued
eoid: ACEz10003653
job_name: MOO_FNBO_MON-3
command: sendevent "-E" "FORCE_STARTJOB" "-"10"
--EOF----
Note: This files begins with autosys2droopy and
ends without the ::::::::::::::::.
It can be variable length and we only want to
print out the stuff between the :::::::::::
if the 3rd line says "job definition change".
THANK YOU SO MUCH...
Laurie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2001 06:36 AM
тАО05-11-2001 06:36 AM
Re: Help with Unix Bourne Shell Script - Loop
I'm on my coffee break and I found the script that was close; the mod's took about 2 minutes.
The attached shell script does a 'here docs' to build an awk script then invokes awk to read stdin and write to stdout. I noticed that you changed the delimiters from '*' to ':'.
You would use it something like this:
laurie.sh < my_infile > my_outfile
Enjoy, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2001 06:36 AM
тАО05-11-2001 06:36 AM
Re: Help with Unix Bourne Shell Script - Loop
I'm on my coffee break and I found the script that was close; the mod's took about 2 minutes.
The attached shell script does a 'here docs' to build an awk script then invokes awk to read stdin and write to stdout. I noticed that you changed the delimiters from '*' to ':'.
You would use it something like this:
laurie.sh < my_infile > my_outfile
Enjoy, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2001 07:25 AM
тАО05-11-2001 07:25 AM
Re: Help with Unix Bourne Shell Script - Loop
I did not get your attached file.
Could you just email it to me at
LAKRUMREY@STATESTREETKC.COM
Thank you,
Laurie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2001 07:28 AM
тАО05-11-2001 07:28 AM
Re: Help with Unix Bourne Shell Script - Loop
I didn't give you enough points so if the
script works I want to give you 10 points.
So post another email here.
Laurie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2001 07:32 AM
тАО05-11-2001 07:32 AM
SolutionI got a 'page cannot be displayed' error after replying but if you look at the posting just above (now my 2nd previous , you,ll see the attachment).
If you still have trouble, I'll email you.
Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2001 08:53 AM
тАО05-11-2001 08:53 AM