Sponsored Content
Top Forums Shell Programming and Scripting awk one liners into a nice script Post 302852897 by RudiC on Thursday 12th of September 2013 02:59:34 PM
Old 09-12-2013
Do you mean like so (a pretty print, give or take):
Code:
gzcat capgw0.log-201308161376632741.gz | sed -n '/2013-08-16 05:56:/,/2013-08-16 05:58:/p' > timebased.log

awk     'FNR==NR && /INFO  - AId:/ {a[$6$8]=$0;next}
         END            {for (i in a) print i "|" a[i]}
        '  FS=":|," timebased.log > t1

awk     '/<?xml versio/ {f=1}
         /<\/iSig>/     {f=0; print $0 "\n" }
         f
        ' timebased.log > t2

awk     'FNR==NR        {a[$1]=$2; next}
         FNR==1         {RS="\n\n"}   
                        { for (i in a)
                                {if ($0~i)      {print a[i] $0 > i".log"; close(i".log")
                                                }
                                }
                        }
        ' FS="|"  t1 t2

This User Gave Thanks to RudiC For This Post:
 

7 More Discussions You Might Find Interesting

1. Programming

nice command and nice() system call

Hi I want to implement the nice command in the shell that I am building. I came to know that there is a corresponding nice() system call for the same. But since I will be forking different processes to run different commands typed on the command prompt, is there any way I can make a command... (2 Replies)
Discussion started by: tejbuch
2 Replies

2. UNIX for Dummies Questions & Answers

How to Turn perl one-liners into full perl script?

I have the following command prompt perl one liner: perl -e 's/\(\)\\,\"]//g; s/^\s//g; s/;/\n/g' -pi result1 I tried to move this one liner into a perl script I am practicing with (just started learning perl right now). I tried the following (I only know how to open a file and output to a... (1 Reply)
Discussion started by: EDALBNUG
1 Replies

3. Red Hat

KSH script help needed ( nice error trap routine ?)

I am running a script that runs a loop and executes a command on ${i} until the end of the for loop. From time to time the command generates an error ( which is good) for example ERROR0005: How can I trap the error and send an email echoing the ${i} variable in the loop and the error ? ... (2 Replies)
Discussion started by: pcpinkerton
2 Replies

4. Shell Programming and Scripting

awk - one liners

Guys, I have a requirement like this. A file has >5K records always. Separated by "|", it has 30 fields for each line. In some lines, I am getting an odd field. say, the 15th field is supposed to be 2 characters but comes in as >2. In this case, for resolving this I need to copy the value of... (6 Replies)
Discussion started by: PikK45
6 Replies

5. Shell Programming and Scripting

Set nice value in an executable in a script?

Is it possible to set a nice value for an executable in a script so that every time the executable runs it has this nice value? I'm trying to set aerender (After Effects terminal renderer) to run at +18 by replacing the original aerender script with a bash script with something like this in it: ... (3 Replies)
Discussion started by: scribling
3 Replies

6. What is on Your Mind?

Those simple one liners

I wanted to say LOL and punch my face when I saw post#11 (where Don_Cragun even reduced the string manipulation with a simple regex) in the thread https://www.unix.com/shell-programming-scripting/220553-add-0-start-filename-2.html I mean, when things can be done with just a one liner, sometimes I... (6 Replies)
Discussion started by: ahamed101
6 Replies

7. AIX

Useful and nice script for AIX,but outdated

How can I quickly see disk usage for my entire system? - IBM: AIX FAQ - Tek-Tips I tried it on aix7.1with ./script -dand give me VG PV size used free location Description rootvg 128 397 149 rootvg 128 212 334 ... (1 Reply)
Discussion started by: Linusolaradm1
1 Replies
xfs_logprint(8) 					      System Manager's Manual						   xfs_logprint(8)

NAME
xfs_logprint - print the log of an XFS filesystem SYNOPSIS
xfs_logprint [ options ] device DESCRIPTION
xfs_logprint prints the log of an XFS filesystem (see xfs(5)). The device argument is the pathname of the partition or logical volume con- taining the filesystem. The device can be a regular file if the -f option is used. The contents of the filesystem remain undisturbed. There are two major modes of operation in xfs_logprint. One mode is better for filesystem operation debugging. It is called the transactional view and is enabled through the -t option. The transactional view prints only the portion of the log that pertains to recovery. In other words, it prints out complete transactions between the tail and the head. This view tries to display each transaction without regard to how they are split across log records. The second mode starts printing out information from the beginning of the log. Some error blocks might print out in the beginning because the last log record usually overlaps the oldest log record. A message is printed when the physical end of the log is reached and when the logical end of the log is reached. A log record view is displayed one record at a time. Transactions that span log records may not be decoded fully. OPTIONS
-b Extract and print buffer information. Only used in transactional view. -c Attempt to continue when an error is detected. -C filename Copy the log from the filesystem to the file filename. The log itself is not printed. -d Dump the log from front to end, printing where each log record is located on disk. -D Do not decode anything; just print data. -e Exit when an error is found in the log. Normally, xfs_logprint tries to continue and unwind from bad logs. However, sometimes it just dies in bad ways. Using this option prevents core dumps. -f Specifies that the filesystem image to be processed is stored in a regular file at device (see the mkfs.xfs(8) -d file option). This might happen if an image copy of a filesystem has been made into an ordinary file with xfs_copy(8). -l logdev External log device. Only for those filesystems which use an external log. -i Extract and print inode information. Only used in transactional view. -q Extract and print quota information. Only used in transactional view. -n Do not try and interpret log data; just interpret log header information. -o Also print buffer data in hex. Normally, buffer data is just decoded, so better information can be printed. -s start-block Override any notion of where to start printing. -t Print out the transactional view. SEE ALSO
mkfs.xfs(8), mount(8). xfs_logprint(8)
All times are GMT -4. The time now is 07:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy