Search Results

Search: Posts Made By: malcomex999
989
Posted By malcomex999
awk to get lowest & store value from another file...
I have two files. One small stores and one with large stores like below...

Small-stores.txt
Store Code Excess Stock
K76 23812 17
K50 23812 6
K16 23812 4
K22 23812 3
K69 23812 3
K76 23813 10...
6,504
Posted By malcomex999
Try this if you don't want to reset the index...
Try this if you don't want to reset the index position for each line...

awk '{ for(i=1;i<=NF;i++)
{ if(index($i,"alice")!=0)
printf ("%d ",index($i,"alice") + len);
...
2,685
Posted By malcomex999
awk -F\| '{for(i=0;++i<=NF;) if($i ~ /Acct/)...
awk -F\| '{for(i=0;++i<=NF;) if($i ~ /Acct/) print substr($i,6)}' infile--
2,685
Posted By malcomex999
Expecting your file is a plain text so try...
Expecting your file is a plain text so try this...

awk -F\| '{for(i=0;++i<=NF;) if($i ~ /Acct/) print $i}' infile
3,205
Posted By malcomex999
awk 'NR==FNR{a[$1 FS $3]=$2;b[$1 FS $4]=$2;next} ...
awk 'NR==FNR{a[$1 FS $3]=$2;b[$1 FS $4]=$2;next}
{print (a[$0] || b[$0]?$0 FS a[$0] b[$0]:$0 FS "-")}' file2 file1
1,085
Posted By malcomex999
nawk '$1>3 {x=x+1;print $0}END{ print "I found...
nawk '$1>3 {x=x+1;print $0}END{ print "I found " x " line have value more than 3" }' file
3,083
Posted By malcomex999
You might see this thread also to see many users...
You might see this thread also to see many users idea and poll result for www.unix.com users...

https://www.unix.com/unix-dummies-questions-answers/19593-what-editor-does-everyone-use.html
...
3,083
Posted By malcomex999
Well, you can write scripting language in any...
Well, you can write scripting language in any editor which you prefer like VI, emac or Ultraedit if you are on windows platform.
3,083
Posted By malcomex999
Well, shell scripts are not compiled and I guess...
Well, shell scripts are not compiled and I guess what you are looking for is shell scripting languages. Perl is one scripting language which you can download it from www.perl.org
3,083
Posted By malcomex999
Have you tried asking Google?:cool:
Have you tried asking Google?:cool:
4,730
Posted By malcomex999
awk '$2 ~ /^ha|^si/ && $1 ~...
awk '$2 ~ /^ha|^si/ && $1 ~ /e$|i$/{$1=substr($1,1,length($1)-1)"a"}1' infile
58,915
Posted By malcomex999
You can use anything as a delimeter... ...
You can use anything as a delimeter...


echo "onewordtwowordthreewordfour" | awk -F"word" '{print $1}'
6,427
Posted By malcomex999
Or... awk -F";" 'NF==6{print...
Or...


awk -F";" 'NF==6{print >"goodfile" ;next}{print >"rejected"}' infile
2,111
Posted By malcomex999
Or... awk -F: '{$0 ~...
Or...


awk -F: '{$0 ~ /^Even/?sql=$0:gsub("seconds",x,$2);sum[sql]=sum[sql] + $2}END{
for(i in sum) print i,"Took[ "sum[i]" ]"
}' infile
1,852
Posted By malcomex999
Try... foreach f ($fnames) echo "$f" |...
Try...
foreach f ($fnames)
echo "$f" | sed 's/\(.*\)-.*$/\1/'
end
1,852
Posted By malcomex999
foreach f ($fnames) echo "${f%-*}" ...
foreach f ($fnames)
echo "${f%-*}"
end
Forum: Solaris 02-06-2011
2,951
Posted By malcomex999
I don't know why you want to convert it to single...
I don't know why you want to convert it to single line again but this might help you though it's lame and you might need to find a way to get rid of the trailing comma in col2,col3 and col5(may be...
1,935
Posted By malcomex999
a) You don't need to declare a variable in awk so...
a) You don't need to declare a variable in awk so x is null.
b) gsub(/\047/,x,$i)
c) $i ~ /[0-9]/ matches any digit found in the element. i.e, it matches 11,a11,11a,1a1,aa1. So, it matches in the...
1,935
Posted By malcomex999
By the way, You created an array of tokens with...
By the way, You created an array of tokens with array name LI1.
And, You initialize the value on LI.
And, in awk, You passed LI1 as input.
LI1 = [] #creates an array of tokens
LI = [3, '*', '(',...
1,935
Posted By malcomex999
Actually, I don't know much about python but in...
Actually, I don't know much about python but in the awk code, after OFS, it's comma as the output field separator. So, try as above by changing which is in red.
1,935
Posted By malcomex999
Can you show the whole code how you are printing...
Can you show the whole code how you are printing the array and running the awk statement?
1,935
Posted By malcomex999
First of all, check how you define an array?
First of all, check how you define an array?
1,935
Posted By malcomex999
Try... awk -F, -v c=\'...
Try...
awk -F, -v c=\' '{for(i=0;++i<=NF;){if($i ~ /[0-9]/){gsub(c,x,$i)}}}1' OFS=,
3,223
Posted By malcomex999
How about if you show what you have with example?
How about if you show what you have with example?
3,223
Posted By malcomex999
With awk... awk -F"[><]" 'NF{print...
With awk...

awk -F"[><]" 'NF{print $2"\n"$(NF-2)}' infile
Showing results 1 to 25 of 474

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