Search Results

Search: Posts Made By: ranjancom2000
14,457
Posted By vbe
On what OS was your input file produced? Looks...
On what OS was your input file produced? Looks like MSsomething... and so I would not be surprised that "$d" contains next line char...
Try and put -CapacityGB $d at the end and see what happens......
8,615
Posted By Scrutinizer
To adjust vgersh99's suggestion try: awk...
To adjust vgersh99's suggestion try:
awk '{i=tolower($1)} FNR==NR {f1[i]=$0;next} i in f1 {print $0, f1[i]}' all-Vms-1.txt all-vm-unix.txt
4,389
Posted By anbu23
$ awk -v RS="\nName:" -v OFS="," -v FS="\n" -v...
$ awk -v RS="\nName:" -v OFS="," -v FS="\n" -v ORS="\nName:" ' { print $1 OFS $2 ($3 ? OFS $3 : "") } ' file
Name: serve1,has disk :Yes,dev (8):
Name: serve2,has disk :No,dev (8):
Name: serve3,has...
6,005
Posted By drysdalk
Hi, The sed command can take care of this...
Hi,

The sed command can take care of this for you:


$ cat test.txt
,001E:001F,,,02EE,0FED:0FEF,
$ sed -i 's/^,//g;s/,$//g' test.txt
$ cat test.txt
001E:001F,,,02EE,0FED:0FEF


The...
4,139
Posted By RudiC
Wouldn't it be nice to post a complete...
Wouldn't it be nice to post a complete specification in the first place, then? And, to show your own ideas and attempts?


Try an awk approach:


awk 'NF == 3 {$2 = ""} 1' file
3 000123456
2...
3,406
Posted By vgersh99
how about: $ echo...
how about:

$ echo '001,0002,0003,004,005,0006,0007,007A,007B,007C,007E,007F,008A,008C' | awk -F, -v b=5 '{for(i=b+1;i<=NF;i=i+b) $i=ORS $i}1' OFS=, | sed 's/,$//'
001,0002,0003,004,005...
4,218
Posted By Corona688
From the instructions for mailsend, -attach...
From the instructions for mailsend, -attach file,mime_type,[i/a] (i=inline,a=attachment)

So -attach "D:\cygwin\home\test.tar.gz,application/tar-gz,a"
1,272
Posted By vgersh99
sort -k4,4 myFile | awk '$4!=p {if(p) print...
sort -k4,4 myFile | awk '$4!=p {if(p) print "Total= " tot;p=$4;tot=0} {print;tot+=$NF} END {print "Total= " tot}'
2,322
Posted By RudiC
Tryawk ' NF < 5 {T[3] = T[3] $1 ...
Tryawk '
NF < 5 {T[3] = T[3] $1
T[4] = T[4] $2
next
}
{if (T[1]) print T[1], T[2], T[3], T[4], T[5]
...
855
Posted By RavinderSingh13
Hello ranjancom2000, Following awk may help...
Hello ranjancom2000,

Following awk may help you on same and it will ONLY look for digits after / if they are more than 3 it will remove everything after /.


awk --re-interval -F"/"...
855
Posted By MadeInGermany
I think you mean slash not backslash. Match 4...
I think you mean slash not backslash.
Match 4 or more non-blanks after a slash, and substitute all this with nothing:
sed 's#/[^ ]\{4,\}##'
1,417
Posted By RavinderSingh13
Hello ranjancom2000, Could you please try...
Hello ranjancom2000,

Could you please try following and let me know if this helps you.

awk 'FNR==NR{a[$3]=$0;next} {printf("%s %s\n",$1 in a?a[$1]:"Notfound",$0)}' Input_file1 Input_file2
...
2,417
Posted By rdrtx1
awk 'FNR == NR {T[$3] = $0; next} {print...
awk 'FNR == NR {T[$3] = $0; next} {print (length(T[$1]) ? T[$1] : "Notfound ") $0}' file1 file2
1,387
Posted By RudiC
Well, I don't think there's NEW challenges on...
Well, I don't think there's NEW challenges on vlookup (which, by the way, is an EXCEL or more generally, spread sheet function not available / applicable in *nix). They all are varieties of...
1,119
Posted By Don Cragun
Try: awk 'FNR==NR {f2[tolower($3)]=$0;next}...
Try:
awk 'FNR==NR {f2[tolower($3)]=$0;next} {print ((tolower($3) in f2)?f2[tolower($3)] OFS:"") $0}' file2 file1
1,119
Posted By vgersh99
awk 'FNR==NR {f2[$3]=$0;next} {print (($3 in...
awk 'FNR==NR {f2[$3]=$0;next} {print (($3 in f2)?f2[$3] OFS:"") $0}' file2 file1
1,427
Posted By Chubler_XL
This will replace if $3 contains an active-server...
This will replace if $3 contains an active-server name (in a similar manor to grep).

I'm not really sure what the vlookup approximate logic is. If this doesn't suit can you be more specific on...
836
Posted By rdrtx1
awk ' /portIndex:/ {if (c++ > 0) print "";...
awk '
/portIndex:/ {if (c++ > 0) print ""; port_info="" ; port_info=$0 " "; next}
/portName:/ {port_info=port_info $0 "," ; next}
{$1=$1; print port_info $0}
' source_file
1,388
Posted By rdrtx1
letter casing on word "[Dd]evice". Original post...
letter casing on word "[Dd]evice". Original post word capitalization is different from second post. Script was updated to account for both.
1,417
Posted By RavinderSingh13
Hello ranjancom2000, My same code is working...
Hello ranjancom2000,

My same code is working for your newly shown Input_file(s), please do let us know what is not working(with complete details). Simply saying not working will not help us to...
899
Posted By rdrtx1
grep -E -v -f ignore_list source_file ...
grep -E -v -f ignore_list source_file
ignore_list file:
test_1([^0-9]|$)
test_2
test_5
1,688
Posted By rdrtx1
awk ' { w=$1; sub("[.].*", "", w); ...
awk '
{
w=$1; sub("[.].*", "", w); # strip first word
if(! a[w]) {b[c++]=w; g=0;} #...
1,688
Posted By rdrtx1
another: awk ' { w=$1; sub("[.].*", "",...
another:
awk '
{
w=$1; sub("[.].*", "", w);
if(! a[w]) {b[c++]=w; g=0;}
a[w]=a[w] $0 ",";
if ($NF ~ /[0-9]*GB$/) {l=$NF; gsub("[^0-9]", "", l); s[w]=(g+=l);}
}
END {
for (i=0;...
1,890
Posted By Don Cragun
Note that if you put "sanpfound," in field 2 and...
Note that if you put "sanpfound," in field 2 and then add in "dummy,"; you'll never find "dummy,snapfound".

If what you want is "snapfound" (which is not what you said you wanted in post #1 in...
1,890
Posted By Yoda
Here is what I get. Note that the sequence of...
Here is what I get. Note that the sequence of input files matters:-
$ cat file1
frame1,dummy,server1, 00C1C N/A RDF1+TDEV RW 51789
frame1,dummy,server1, 00C1D N/A RDF1+TDEV RW 51789...
Showing results 1 to 25 of 34

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