Sponsored Content
Full Discussion: Using awk to Parse File
Top Forums Shell Programming and Scripting Using awk to Parse File Post 302894704 by jethrow on Wednesday 26th of March 2014 07:26:43 PM
Old 03-26-2014
... based off your original data ...
Code:
gawk '
	BEGIN {
		printf("%-14s %-65s %-41s %-8s %-18s %-18s %-16s %-16s\n",
		"System Number","Job Name","Target Machine","Status","Actual Start Date",
		"Actual Start Time","Actual End Date","Actual End Time") }
	$0~/^[A-Z]/ {
		match($1,/([0-9]+)/,s); s[2]=$1 }
	$1=="STARTING" {
		if(!s[3]) s[3]=$8; s[5]=$2; s[6]=$3 }
	$1~/^(SUCCESS|FAILURE)$/ {
		printf("%-14s %-65s %-41s %-8s %-18s %-18s %-16s %-16s\n",
		s[1], s[2], s[3], $1, s[5], s[6], $2, $3) }
' your_file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parse file using awk and work in awk output

hi guys, i want to parse a file using public function, the file contain raw data in the below format i want to get the output like this to load it to Oracle DB MARWA1,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 MARWA2,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 this the file raw format: Number of... (6 Replies)
Discussion started by: dagigg
6 Replies

2. Shell Programming and Scripting

AWK - Parse a big file

INPUT SAMPLE Symmetrix ID : 000192601507 Masking View Name : TS00P22_13E_1 Last updated at : 05:10:18 AM on Tue Mar 22,2011 Initiator Group Name : 10000000c960b9cd Host Initiators { WWN : 10000000c960b9cd } Port Group Name :... (8 Replies)
Discussion started by: greycells
8 Replies

3. Shell Programming and Scripting

Parse a file with awk?

Hi guys (and gals). I need some help. I'm running an IVR purely on Asterisk where I capture the DTMFs. After pulsing each DTMF I have Asterisk write to a file with whatever was dialed (mostly used for record-keeping) and at the end of the survey I write all variables in a single line to a... (2 Replies)
Discussion started by: tulf210
2 Replies

4. Shell Programming and Scripting

AWK Command parse a file based on string.

AWK Command parse a file based on string. I am trying to write a shell script to parse a file based on a string and move the content of the file to another file. Here is scenario. File content below Mime-Version: 1.0 Content-Type: multipart/mixed; ... (2 Replies)
Discussion started by: aakishore
2 Replies

5. Shell Programming and Scripting

AWK script to parse a data in a file

Hi Unix gurus.. I have a file which has below data, It has several MQ Queue statistics; QueueName= 'TEST1' CreateDate= '2009-10-30' CreateTime= '13.45.40' QueueType= Predefined QueueDefinitionType= Local QMinDepth= 0 QMaxDepth= 0 QueueName= 'TEST2' CreateDate= '2009-10-30'... (6 Replies)
Discussion started by: dd_psg
6 Replies

6. Shell Programming and Scripting

Parse a file using awk

Hi Experts, I am trying to parse the following file; FILEA a|b|c|c|c|c a|b|d|d|d|d e|f|a|a|a|a e|f|b|b|b|boutput expected: a<TAB>b <TAB><TAB>c<TAB>c<TAB>c<TAB>c<TAB> <TAB><TAB>d<TAB>d<TAB>d<TAB>d<TAB> e<TAB>f <TAB><TAB>a<TAB>a<TAB>a<TAB>a<TAB> <TAB><TAB>b<TAB>b<TAB>b<TAB>b<TAB>*... (7 Replies)
Discussion started by: rajangupta2387
7 Replies

7. Shell Programming and Scripting

awk to parse html file

Is it possible in awk to parse a webpage (EDAR Gene Sequencing - Genetic Testing Company | The DNA Diagnostic Experts | GeneDx), the source code is attached. <title> EDAR Gene Sequencing <dt>Test Code:</dt> <dd>156 </dd> <dt>Turnaround Time:</dt> <dd>6-8 weeks </dd> ... (4 Replies)
Discussion started by: cmccabe
4 Replies

8. Shell Programming and Scripting

awk or perl to parse file

I have an input file attached that I am trying to parse in tab-delimanted format: The chromosomal variant column contains all the information: parse rules: 1. 4 zeros after the NC_ and the digits before the . 2. digits after the g. repeated twice separated by a tab 3. letter before the > 4.... (10 Replies)
Discussion started by: cmccabe
10 Replies

9. Shell Programming and Scripting

awk parse result that match data from file

i run command that return this result,example : gigabitethernet2/2/4:NotPresent, gigabitethernet2/1/17:UP, gigabitethernet2/1/10:UP, gigabitethernet2/1/5:UP, gigabitethernet2/1/9:UP, gigabitethernet2/1/36:DOWN, gigabitethernet2/1/33:DOWN, gigabitethernet2/1/8:UP,... (19 Replies)
Discussion started by: wanttolearn1
19 Replies

10. Shell Programming and Scripting

How to parse this file using awk and output in CSV format?

My source file looks like this: Cust-Number = "101" Cust-Name="Joe" Cust-Town="London" Cust-hobby="tennis" Cust-purchase="200" Cust-Number = "102" Cust-Name="Mary" Cust-Town="Newyork" Cust-hobby="reading" Cust-purchase="125" Now I want to parse this file (leaving out hobby) and... (10 Replies)
Discussion started by: Balav
10 Replies
limits(5)							File Formats Manual							 limits(5)

NAME
limits - implementation-specific constants SYNOPSIS
DESCRIPTION
The following symbols are defined in and are used throughout the descriptive text of this manual. The column headed HP-UX Value lists the values that application writers should assume for portability across all HP-UX systems. Symbols after values are interpreted as follows: Actual limit might be greater than specified value on certain HP-UX systems. Actual limit might be greater than value specified in on certain HP-UX systems. Actual limit might be less than the specified value on certain HP-UX systems. Actual limit is always equal to the specified value and does not vary across HP-UX systems. The name of this limit is defined if the preprocessor macro is defined, either by the compilation flag or by a directive in the source before is included in the source. The value defined for this limit might not be a compile-time constant. The value defined always evaluates to an integer expression at run time. Some of these limits vary with system configuration, and can be determined dynamically by using sysconf(2). Others can vary according to file system or device associated with a specific file, and can be determined with pathconf(2). Others are obsolescent because they are redundant with other limits or not useful in portable applications. They are provided only for importability of applications from other systems, to support applications that comply with the and for backward compatibility with earlier versions of HP-UX. The flag should not be defined in new applications. By including the file in the compilation an application can test the appropriate limits to determine whether it can operate on a particular system, or it might even alter its behavior to match the system to increase its portability across a varying range of limit settings and systems. Constant Description HP-UX Value -------------------------------------------------------------------- ARG_MAX Max length of arguments to 5120 +* exec(2) in bytes, including environment data CHAR_BIT Number of bits in a 8 = CHAR_MAX Max integer value of a 127 = CHAR_MIN Min integer value of a -128 = CHILD_MAX Max number of simultaneous 25 +-* processes per user ID CLK_TCK Number of clock ticks per 50 +# second DBL_DIG Digits of precision of a 15 + DBL_MAX Max positive value of a 1.7976931348623157e+308 + DBL_MIN Min positive value of a 4.94065645841246544e-324 - FCHR_MAX Max file offset in bytes INT_MAX +-* FLT_DIG Digits of precision of a 6 + FLT_MAX Max positive value of a 3.40282346638528860e+38 + FLT_MIN Min positive value of a 1.40129846432481707e-45 - INT_MAX Max decimal value of an 2147483647 + INT_MIN Min decimal value of an -2147483648 - LINE_MAX Max number of characters in 2048 = a single line LINK_MAX Max number of links to a 32767 +* single file LOCK_MAX Max number of entries in 32 +-* system lock table LONG_BIT Number of bits in a 32 + LONG_MAX Max decimal value of a 2147483647 + LONG_MIN Min decimal value of a -2147483648 - MAX_CANON Max number of bytes in ter- 512 +* minal canonical input line MAX_CHAR Max number of bytes in ter- MAX_INPUT =* minal input queue MAX_INPUT Max number of bytes in ter- 512 +* minal input queue NAME_MAX Max number of bytes in a 14 +* path name component NL_ARGMAX Max value of "digits" in 9 = calls to the NLS printf(3S) and scanf(3S) functions NL_MSGMAX Max message number in an NLS 32767 + message catalog NL_SETMAX Max set number in an NLS 255 + message catalog NL_TEXTMAX Max number of bytes in an 8192 + NLS message string NGROUPS_MAX Max number of supplementary 20 ++ groups per process OPEN_MAX Max number of files a 60 +* process can have open PASS_MAX Max number of chars in a 8 + password PATH_MAX Max number of characters in 1023 +* a path name excluding the null terminator PID_MAX Max value for a process ID 30000 + PIPE_BUF Max number of bytes atomic 8192 +* in write to a pipe PIPE_MAX Max number of bytes writable INT_MAX + to a pipe in one write PROC_MAX Max number of simultaneous 84 +-* processes on system SCHAR_MAX Max integer value of a 127 = SCHAR_MIN Min integer value of a -128 = SHRT_MAX Max decimal value of a 32767 + SHRT_MIN Min decimal value of a -32768 - STD_BLK Number of bytes in a physi- 512 + cal I/O block SYSPID_MAX Max process ID of system 4 +-* processes SYS_NMLN Length of strings returned 8 +* by uname(2) SYS_OPEN Max number of files open on 120 +-* system TMP_MAX Max number of unique names 17576 + generated by tmpnam(3S) UCHAR_MAX Max integer value of an 255 = UID_MAX Smallest unattainable value 2147483647 + for a user or group ID UINT_MAX Max decimal value of an 4294967295 + ULONG_MAX Max decimal value of an 4294967295 + USHRT_MAX Max decimal value of an 65535 + USI_MAX Max decimal value of an UINT_MAX =* WORD_BIT Number of bits in a "word" 32 + EXAMPLES
has an HP-UX value of which means that on all HP-UX systems the smallest unattainable value for a user or group ID is at least 2147483647. A particular system might be capable of supporting more than 2147483647 user or group IDs, in which case its file sets to a higher value; however, any application assuming such a higher value is not guaranteed to be portable to all HP-UX systems. has an HP-UX value of which means that on all HP-UX systems the smallest maximum number of supplementary groups per process is at least 20. A particular system might be capable of supporting more than 20 supplementary groups per process, in which case will return a larger value than that specified in however, any application assuming such a higher value is not guaranteed to be portable to all HP-UX systems. AUTHOR
limits was developed by HP. SEE ALSO
exec(2), fcntl(2), fork(2), getgroups(2), link(2), lockf(2), open(2), pathconf(2), sysconf(2), uname(2), write(2), printf(3S), scanf(3S), tmpnam(3S), passwd(4), values(5), termio(7). STANDARDS CONFORMANCE
limits(5)
All times are GMT -4. The time now is 03:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy