Search Results

Search: Posts Made By: greycells
8,415
Posted By RudiC
Is it possible to e.g. sort -t, -k2,2 -k4r...
Is it possible to e.g.

sort -t, -k2,2 -k4r -k3 file
889
Posted By rdrtx1
try: awk '!/,/ {a=0} /,/ && a++ {FS=OFS=",";...
try:
awk '!/,/ {a=0} /,/ && a++ {FS=OFS=","; $0=$0; $1=$2=""} 1' infile
1,865
Posted By Don Cragun
Try: gawk ' { for(i = 1; i <= NF; i++) ...
Try:
gawk '
{ for(i = 1; i <= NF; i++)
if((n = split($i, f, ";")) > 1) {
o = ""
for(j = 1; j <= n; j++)
o = o "[" f[j] "]"
$i = o
}
}
1' FS=, OFS=, out
where out is a file...
1,865
Posted By Don Cragun
Try: gawk ' { A[i = $6] for(j = 1; j <= 5;...
Try:
gawk '
{ A[i = $6]
for(j = 1; j <= 5; j++)
if(!((i, j, $j) in d)) {
d[i, j, $j]
outd[i, j] = outd[i, j] ? outd[i, j] ";" $j : $j
}
}
END { for(i in A)
print outd[i,1],...
2,686
Posted By Aia
Change -F '[][:]' to -F '[]:[]' instead.
Change -F '[][:]' to -F '[]:[]' instead.
2,686
Posted By Scrutinizer
Or: awk -F '[][:]' '{gsub(/,[[:space:]]*/,";")}...
Or:
awk -F '[][:]' '{gsub(/,[[:space:]]*/,";")} NF>1{print $1 "," $3}' RS=/ file
2,686
Posted By RudiC
Orawk ' /:$/ {sub (/:/, ",") ...
Orawk '
/:$/ {sub (/:/, ",")
n = split ($0, T, "/")
printf "%s", T[n]
}
/^initia/ {while (!/]$/) {getline X
...
2,686
Posted By Yoda
Another approach:- gawk -F'[][,/:]' ' ...
Another approach:-
gawk -F'[][,/:]' '
/storage-views/ {
name = $(NF-1)
next
}
/^initiators/ {
flag = 1
}
...
2,686
Posted By RavinderSingh13
Hello greycells, Following may help you...
Hello greycells,

Following may help you same, could you please try it and let me know if this helps you.

awk '/^\/clusters\/*/{if(A){print A;A=""};gsub(/.*\/|\:/,X,$0);A=$0}...
1,196
Posted By RudiC
How about awk -F"," ' FNR == 1 {FC++ ...
How about awk -F"," '
FNR == 1 {FC++
}
FC < 3 {a[FC,$2]=$1
next
}
{X = Y = "N/A"
n = split...
873
Posted By RudiC
With the assumption that storage-view: ALWAYS...
With the assumption that storage-view: ALWAYS precedes the respective virtual-volume:, a CNT of 0 indicates there hasn't been a storage-view when the virtual-volume is encountered, and it creates an...
873
Posted By RudiC
You're not too far off. Try awk ' ...
You're not too far off. Try awk '
/storage-view:/ {SNAME[++CNT]=$2
}
/virtual-volume:/ {VV=$2
HA=$4
BA=$6...
2,018
Posted By Scrutinizer
I see, ok, try: awk ' { i=$3 FS $8 ...
I see, ok, try:
awk '
{
i=$3 FS $8
p=(i in A)
}
NR==FNR {
A[i]=A[i] (p?";":x) $2
B[i]=B[i] (p?";":x) $6
next
}
p {
$2=A[i]
$8=B[i]
delete...
1,624
Posted By RavinderSingh13
Hello greycells, Could you please try...
Hello greycells,

Could you please try following and let us know if this helps you.
Let's say we have input file is as follows.

cat testt1...
1,624
Posted By RudiC
This works if the patterns don't repeat further...
This works if the patterns don't repeat further down the file. For e.g. AU01NAS002,FCNVX133800117,AU01_Melbourne_Australia,ATT,Internal,NAS SILVER,12287.99,3293.98,6946.02...
1,624
Posted By Akshay Hegde
awk 'x[$1,$2,$3,$4,$5]++{$1=$2=$3=$4=$5=""}1'...
awk 'x[$1,$2,$3,$4,$5]++{$1=$2=$3=$4=$5=""}1' FS=, OFS=, infile
735
Posted By Scrutinizer
Modification to your original attempt. Try: awk...
Modification to your original attempt. Try:
awk 'NR==FNR{a[$1]=$2;next}{for (i in a) sub("[^,]*" i "[^,]*",a[i],$2)}1' FS=, OFS=, /tmp/reference /tmp/input

or

awk 'NR==FNR{a[$1]=$2;next}{for...
735
Posted By derekludwig
From the looks of the results, would it be fair...
From the looks of the results, would it be fair to say that you want the name of the first subdirectory in column two, that is if column two has /a/b/c/d, the result should be "b"? If so, a small...
4,027
Posted By derekludwig
Change the definition of @K to: my @K = qw{...
Change the definition of @K to:
my @K = qw{ name root access ro rw comment };
If the square braces are cosmetic, then change the print to:
print $dir, map { defined $O{$_} ? $O{$_} : '' } @K;...
4,027
Posted By derekludwig
The problem is the field separator occurs in the...
The problem is the field separator occurs in the field. For example:
export "/0014apps/test folder" name="/reet" root=10.200.12.29:10.200.12.32 access=10.200.12.29:10.200.12.32
to be split into...
4,027
Posted By RudiC
It does not help leaving the windows <CR> line...
It does not help leaving the windows <CR> line separators in your sample. Get rid of them first.

Then tryawk 'BEGIN {nK=split ("name root access ro rw", K)}
...
4,027
Posted By derekludwig
Something like: BEGIN { FS = "\" \"|\" |...
Something like:
BEGIN {
FS = "\" \"|\" | \"";
OFS = ",";
}

{
split($3, P, "/");

N = "<unknown>"; # netbios name
n = split($4, A, "[ =]");
for (i = 1; i <= n; i += 2) { if...
4,027
Posted By Akshay Hegde
For given sample input this will work Either...
For given sample input this will work

Either setting FS
awk -F'"|=' '{split($4,A,/\//); print A[2],"["$2"]("$NF")","["$4"]"}' OFS=, infile

OR lengthy match
awk '{print...
4,027
Posted By derekludwig
A perlish solution: $ perl -ne ' @F =...
A perlish solution:
$ perl -ne '
@F = m{^[^"]+"([^"]+)"\s+"(/([^/"]+)[^"]*)".*netbios=(\S+)}i;
print $F[2], ",[", $F[0], "](", $F[3], "),[", $F[1], "]\n";
' file...
1,090
Posted By RudiC
Not too elegant - mayhap the printing should be...
Not too elegant - mayhap the printing should be done the way you implemented it - but it seems to give what you requested:awk 'BEGIN {print "Symmetrix ID,DEV,Storage Group Name,Port...
Showing results 1 to 25 of 77

 
All times are GMT -4. The time now is 04:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy