- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- newbie needs a script
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
12-17-2002 12:52 AM
12-17-2002 12:52 AM
newbie needs a script
i have five log-files, say generation, deletion, filtering,sorting and summarizing. each of this logs contains 3 entries say for generation-log (generation a, b, c...), deletion (deletion a, b, c...) which are variable in length. i wana make a script that could collect the details from each log and integrated the details into file a, file b and file c. so the output files will then be, File a - contains generation a, deletion a, filtering a, sorting a and summarizing a logs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2002 04:29 AM
12-17-2002 04:29 AM
Re: newbie needs a script
grep a deletion >> a.log
grep a filtering >> a.log
grep a sorting >> a.log
grep a summarizing >> a.log
repeat for b, c, etc.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2002 04:48 AM
12-17-2002 04:48 AM
Re: newbie needs a script
grep -e a -e b -e c generation deletion filtering sorting ... > a.log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2002 04:51 AM
12-17-2002 04:51 AM
Re: newbie needs a script
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2002 04:38 PM
12-17-2002 04:38 PM
Re: newbie needs a script
=========a==============
fasdfasdf asdfasdf
asf adf
asf
asdf
asdf
asfasdfasdf
asfasdfasdf
==>end of a
=========b==============
fasdfsadf
asf
asdf
asfsd
af
==>end of b
=========c==============
asdf
asdf
asfs
adf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2002 06:14 PM
12-17-2002 06:14 PM
Re: newbie needs a script
What are you identifying as a "LOG" ?????????
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2002 06:45 PM
12-17-2002 06:45 PM
Re: newbie needs a script
actually, its not a log. its an output of a program which we have to filter manually then integrate it to files as reports.
the raw output is usually combination of alpha numeric, with some details that we don't need. usually separted as:
file output 1
======generation a====
asf13asdf
asdf134
asdf12323...
=====end of generation a==
==generation b====
afasdf123123
asdfsadf13
asdfasdf...
==end of generation b===
the other outputs have more orless the same format.
with filtering/removing unwanted details, i have already created a script which mostly uses grep. i have a problem in intergarting them to final data. say, file A should contain output1 A, output2 A, output 3 A...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 04:35 AM
12-18-2002 04:35 AM
Re: newbie needs a script
if the files all have the same size, you could use a script like this one (untested):
#! /usr/bin/ksh
>result.txt
let nl=`wc -l file1`
let i=1
while [ $i -le $nl ]
do
a= `head -n $i file1|tail -n 1`
b= `head -n $i file2|tail -n 1`
c= `head -n $i file3|tail -n 1`
echo $a $b $c >> result.txt
let i=$i+1
done
As I don't have access to my platform currently, I couldn't test this cript, but it should not be far from the wished result.
Of course, the head|tail part of the script means that you're reading nl*(nl+1)*2 lines, but that's, after all, still a polynomial algorithm ;-)
Cheers,
FiX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 05:02 AM
12-18-2002 05:02 AM
Re: newbie needs a script
You could also try a script like this one :
#!/usr/bin/sh
TASK=$1
shift
OUTFILE=$TASK.out
awk '
/=generation '$TASK'=/,/=end of generation '$TASK'=/
/=deletion '$TASK'=/,/=end of deletion '$TASK'=/' $* > $OUTFILE
You could of course use a more complex pattern to delimit begin and end of blocks ... It's really simple because awk use its default action (printing line) for every linesbetween patterns.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2002 05:29 AM
12-18-2002 05:29 AM
Re: newbie needs a script
Regards.