Tagged Questions
3
votes
3answers
47 views
checking data in columns when a data or some may be missing or present?
I am not sure if this possible.
say i have columns like :
Team Colour Game Rainfall PlayerName
XYZ Blue Cricket Yes Kapil
suppose i need to search ...
5
votes
4answers
119 views
Show sum of file sizes in directory listing
The Windows dir directory listing command has a line at the end showing the total amount of space taken up by the files listed. For example, dir *.exe shows all the .exe files in the current ...
6
votes
7answers
612 views
Slick one-liner to convert a list like “1: 2, 3, 4, 5” to “1.2, 1.3, 1.4, 1.5”
Let's say I have a file that looks something like this:
23: a, b, c, d
24: b, d, f
25: c, g
and I want to get output like this:
23.a
23.b
23.c
23.d
24.b
24.d
24.f
25.c
25.g
Of course it's not ...
3
votes
4answers
99 views
Replacing pattern after nth match is found on each line?
I have a file containing lines:
india;austria;japan;chile
china;US;nigeria;mexico;russia
I want to replace all the occurences of semicolon on each line with e.g. ;NEW;, but starting from the 2nd ...
0
votes
0answers
46 views
how to parse this data and count the matching patterns? [closed]
Gi1/0/12
Gi1/0/13
Gi1/0/14
Gi1/0/15
Gi1/0/16
Gi1/0/17
Gi1/0/18
Gi1/0/19
Gi1/0/20
Gi1/0/21
Gi1/0/22
Gi1/0/23
Fa2/0/13
Fa2/0/14
Fa2/0/15
Fa2/0/16
Fa2/0/17
Fa2/0/18
Fa2/0/19
Fa2/0/20
Fa2/0/21
Fa2/0/22
...
1
vote
1answer
68 views
How to parse this output and put it into an array?
i have expect script whose output looks like :
I would like to extract all words like Gi/02/12 etc in an array or a list.
VLAN Name Status Ports
---- ...
2
votes
2answers
99 views
changing pattern by removing spaces?
file :
hi hello,new york, , ,brazil site ,brazil
january,month is feb , , ,indiana jones
task:
delete all horizontal space (spaces and tab) between any two comas (like , ,) if ...
2
votes
1answer
110 views
shell variable in awk is not being passed to all the lines but just for the very first line of input?
inputfile:is2.txt
10.39.5.41,A1,B1
10.39.5.41,A2,B2
10.39.5.41,A3,B3
10.39.5.41,A4,B4
10.39.5.41,A5,B5
10.39.5.41,A6,B6
script :
#!/bin/bash
second_column="OOOOOOO" # OOOOOOO will be added to ...
1
vote
0answers
83 views
reading from a file and changing its pattern into an array?
I have a CSV file containging entries like this :
ipaddress,VLAN,VLANid
10.192.168.1,vlan-xyz,3
10.192.168.1,vlan-abc,8
10.192.168.1,vlan-mnp,11
10.192.163.24,vlan-llz,3
10.192.163.24,vlan-bbz,5
...
1
vote
2answers
107 views
sed pattern matching with deletion over a line
I want to delete only some spaces(say 4) after the line$#*425 with space
I am not able to complete it please suggest
echo "line$#*425 with space " | sed 's/ /\1 \2/g'
i am thinking of ...
4
votes
4answers
555 views
Text between two tags
I wanna retrieve whatever is between these two tags – <tr> </tr> – from an html doc.
Now I don't have any specific html requirements that would warrant for an html parser. I just plain ...
5
votes
2answers
172 views
what is the meaning of 1 at the end of awk script
I was reading this awk script
awk -F"=" '{OFS="=";gsub(",",";",$2)}1'
I want to know what is the function of 1 at the end of it
1
vote
3answers
257 views
linux/solaris + verify duplicate valid IP address from file
what the best way to find duplicate IP from file ( I have ksh script in this script I need to write function that check for duplicate IP )
for example if IP - 192.1926.23.52 exists twice in file - ...
2
votes
1answer
355 views
Bash variable in Awk script
I have this flat file database(ff_servers.db) with following contents:
192.168.154.2 Alaska hp
192.168.157.3 Colorado dell
192.168.156.3 hawaii hp
From command line, I could run:
awk ...
0
votes
1answer
61 views
Why is this variable not getting passed to awk? [duplicate]
Possible Duplicate:
external variable in awk
How do I pass this variable below?
This doesn't work:
fname=testfile.txt
lsof | awk '/deleted/&&/$fname/ {print $4}' *----no output*
...