I am extracting a number of key/value pairs in awk using following:
I don't like this Index + substr with manually calculated length construct - is there a good techinque to do it?
Sample of my input:
I run sed 's/\[//;s/\]//;s/\?/ /' $1 | awk -f my-code-above
my output:
I do need to show a couple more values, such as phone etc., I'd hate to code another index + substr.
Ideal for me would be to have array of keys defined, such as :
Then in processing each line I'd cycle through my arr of keys and get each key's length, find its position, position + lenght gives me beginning of the value for the key and so on. Is it doable?
Would anyone help in putting pieces together? Or some other approach?
Hi all,
I need some help with using sed/awk/other linux tools to meet the following goal:
I'm trying to take the output of /proc/net/dev:
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes ... (0 Replies)
Hello,
I have a file Pairs.txt composed of 3 columns. For simplicity, this is the file:
A B C
B D W
X Y Z
Z W K
B A C
Y J Q
F M P
Y X Z
I am trying to reduce the file such that I only keep the first occurrence of any "pair". In the example above, I would only want to keep one... (6 Replies)
Hello,
I have property file with key value pairs separated by pipe , I am trying to write a script which reads the property file and search and print value of specific key. I tried with Sed, I am successfull.
The file is as follows
... (4 Replies)
Hi everyone!
I know you can extract public keys from a keystore using the keytool command.
But what is the process to extract a private key from a jks keystore and import into another jks keystore using keytool?
Any guidance would be greatly appreciated! I can't seem to find anything, I do... (0 Replies)
consider a line from a file is stored in a variable called $var
i.e.
var=" KEY `controllingZoneId` (`controllingZoneId`),"
or it can be (i.e without comma at the end)
var="KEY `requestingUserId` (`requestingUserId`)"
here i need to extract KEY and 1st and 2nd word
i want to know how... (7 Replies)
Hi experts,
e.g.
i/p data looks like
0000xm7zcNDIkP888vRqGv93xA7:176n00qql||9700005405552747,9700005405717924,9700005405733788|unidentified,unidentified,unidentified||
o/p data should like -
row1: 0000xm7zcNDIkP888vRqGv93xA7:176n00qql||9700005405552747|unidentified
... (1 Reply)
Hi all,
please help me construct the command. i want to loop through all files named bam* and bed*. My awk works for a particular pair but there are too many pairs to do manually.
I have generated multiple files in a folder in a given pattern. The files are named like
bam_fixed1.bam... (2 Replies)
Hi All,
I have question , How to generate the SSH keys for the two servers in the pair.
So if the server will be replicated , same SSH key pairs will work on each server. No need to generate the SSH keys for the second server.
I have created the SSH keys for the single server. I was... (1 Reply)
In a huge log file (43MB, 43k lines) I am trying to extract data between two tag pairs on same line and export it to a file so I can pull it into Excel for a report.
One Pair is <Text>data I need</Text>
Other pair follows on same line and is <TimeStamp>more data I need</TimeStamp>
I would need... (2 Replies)
Discussion started by: NanookArctic
2 Replies
LEARN ABOUT REDHAT
igawk
IGAWK(1) Utility Commands IGAWK(1)NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
SEE ALSO gawk(1)
Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995.
AUTHOR
Arnold Robbins (arnold@skeeve.com).
Free Software Foundation Nov 3 1999 IGAWK(1)