hi all
the following program needs to print the words
First
Second
Third
But because i parameter from awk not get the value from “for” loop its print all words:
First second third
First second third
First second third
How to fix awk in order to print first the “first” word second the “second” word and so on
TH...
i have two text files
file 1
number,name,account id,vv,sfee,dac acc,TDID
7000,john,2,0,0,1,6
7001,elen,2,0,0,1,7
7002,sami,2,0,0,1,6
7003,mike,1,0,0,2,1
8001,nike,1,2,4,1,8
8002,paul,2,0,0,2,7
file 2
number,account id,dac acc,TDID
7000,2,1,6
7001,2,1,7
7002,2,1,6
7003,1,2,1
i want to compare those two text files. if the four col...
I have an input file in following manner
<td> Name1 </td>
<td> <span class="test"><a href="url1">Link </a></span></td>
<td> Name2 </td>
<td> <span class="test"><a href="url2">Link </a></span></td>
I want a awk script to read this file and output in following manner
url1 Name1
url2 Name2
Can anyone help me out in this trivial lookin...
How would i join two lines usung awk or sed?
for eg:
i have data like below:
abcd
joinabcd
efgh
joinefgh
ijkl
joinijkl
i need oupput like below:
joinabcdabcd
joinefghefgh
joinijklijkl
...
Short background: I need to monitor the permissions on a unix file (a directory) with ZABBIX to see if/when they change. ZABBIX doesn't have any built in like vfs.file.mode[xxxx] for this, so I had to roll my own UserParameter, with a numeric type.
What I do so far, is use ls -l | cut -c 2-10 to get the rwxr-xr-xpart, and then use sed t...
Question says it all. I've tried using awk 'BEGIN{RS=\"} /Match/{print $0}' input and every combination of escaping and quoting I could think of. Any Ideas how to pull this off?
...
I have a script where a user provides a date, start time and end time. The script will take these values and scan a log file to search for key words in the log file that fall within the time range. When a user uses AM times (Example: 0700 to 0900 - this is 7am to 9am) as a range or PM times (Example: 1400 to 1600 - this is 2pm to 4pm) as...
I have a peculiar problem replacing some text in an xml file using awk regex matching.
The xml files are simple. There's a paragraph of text in the node of each xml and the awk program replaces this text with another paragraph of text picked from the text file rtxt. But for some reason the text in rtxt (labeled '42') that substitutes t...
Hi all,
I am learning to use sed and have a hypothetical requirement:
bash$ cat states
California
Massachusetts
Arizona
Wisconsin
I would like the output: (Basically I want only one blank line in between)
California
Massachusetts
Arizona
Wisconsin
Please suggest ways to do it with sed.
Should it use concept of multiline pa...
Hi all,
This is my 3rd post in the process of learning sed. I have a hypothetical requirement. I want to be able to replace 3rd word in each line by 'was', where words are delimited by space(s).
bash$ cat words
hi this is me here
hi this is me again
hi this is me yet again
hi this is me
Desired output:
hi this was me h...
Hi
i have the output of cat /proc/loadavg and
/proc/meminfo MemFree: 1191220 kB
i need a to know who will i get a script to get then added in a logfile every 5 mins.
eg: CPU; Mem;
10.0; 1191220
and so on so the next entry will be below that
eg: CPU; Mem
10.0; 1191220
5.0; 2229882
Thanks in advance
...
I am trying to extract conversations from a Postfix log file based on the client that initiated them. This is the awk script that extracts the matching message IDs:
awk '/client.host.name/ && !(/timeout/||/disconnect/) { sub(":","",$6);print $6}' maillog
This is using a standard Postfix maillog as input (see below for sample data). Wha...
I've a file with 2 lines having key, value pair on each line. "//" is used as comment style.
1. key = "string_key_value" //string key
How can I extract string_key_value without quotes?
2. key =100 //integer value
How can I extract 100 from here as an integer?
I've to re-use these values in another unix command.
...
I can run this command fine, with the output I want:
ifconfig eth0 | grep HWaddr | awk '{print $5}'
However, when I set the command to a variable, and print the variable, I get an error:
CASS_INTERNAL=`ifconfig eth0 | grep HWaddr | awk '{print \$5}'`
$CASS_INTERNAL
my internal xxx ip: command not found
The weird thing - my intern...
I have file like this.. for eg:
number,dac,amountdac,expdate,0
1111,1,0.000000,2010-07-21,0
1111,2,0.000000,2010-07-21,0
1111,3,0.000000,2010-07-21,0
1111,4,0.000000,2010-07-21,0
1111,5,0.000000,2010-07-21,0
1111,6,0.000000,2010-07-21,0
1111,7,0.000000,2010-07-21,0
1111,8,0.000000,2010-07-21,0
1111,9,0.000000,2010-07-21,0
1111,10,0.0000...
Hi,
I have got output from several different log files:
logfile3
2010/07/21 15:28:52 INFO xxx
2010/07/21 15:31:25 INFO xxx
2010/07/21 15:31:25 DEBUG xxx
logfile1
2010/07/21 19:28:52 INFO xxx
2010/07/21 19:31:25 INFO xxx
2010/07/21 19:31:25 DEBUG xxx
logfile2
2010/07/21 13:28:52 INFO xxx
2010/07/21 13:31:25 INFO xxx
2010/07/21 13:31:2...
i tried the awk liner below(on windows command-prompt):not working properly
gawk -v var="hot" "{ if(!NR){gsub(/cool/,var,$0) ;print} else{print}}" awk_test
input file is below
this is a cool jack
this nota cool kack
this obviously a cool jack
a unix solution is also feasible
...
Hi
I have the following file
your Answer = AA
your Answer = AB
your Answer = CD
your Answer = XY
your Answer = DD
to verify all answers I run the following awk
echo "your Answer = AA" | awk '/= AA/{print " passed "}'
echo "your Answer = AA" | awk '/= AB/{print " passed "}'
echo "your Answer = AA" | awk '/= CD/{pr...
hi all
I have a problem with the following awk syntax
echo " param1 param2 param3 = param1 AA , AB , AC , AD " | awk -F"=" '$2~/AA|AB|AC|AD/{print "passed"}'
The awk prints "passed", but it shouldn't be because after "=" I have "param1" and not "AA" or AB", etc.
The target of the awk is to print "passed" only if the string after "...
hi all
I don't know how to do this with awk
But my target is to create awk one line syntax in order to print the second field ($2) if
all first field ($1) are true
for example
I have the file:
true my_name_is_lenon
true my_name_is_lenon
true my_name_is_lenon
false my_name_is_lenon
true my_name_is_lenon
false my_d...