Search Results

Search: Posts Made By: vgersh99
402
Posted By vgersh99
be careful... some awk's don't have NR available...
be careful... some awk's don't have NR available in the END block. Just reassign NR to nr in your "main" block and use it in the END.
Forum: Shell Programming and Scripting 3 Weeks Ago
221
Posted By vgersh99
YMMV: sed 's/.*=\(.*\)$/\1/' myFile awk...
YMMV:

sed 's/.*=\(.*\)$/\1/' myFile
awk -F= '{print $NF}' myFile
635
Posted By vgersh99
just to add another "hint": look at the bottom of...
just to add another "hint": look at the bottom of this in the section titled: 10 More Discussions You Might Find Interesting
152
Posted By vgersh99
a bit verbose, but a possible starter. awk -f ...
a bit verbose, but a possible starter.
awk -f bunny.awk inputfile2.txt inputfile1.fa where bunny.awk is:

function printRec() {
#print a[f], s[f], e[f]
for ( i in s) {
split(i,t,...
152
Posted By vgersh99
if you need to "fold" the lines at 60 char width,...
if you need to "fold" the lines at 60 char width, pipe the output to fold:
awk .... | fold -w 60
982
Posted By vgersh99
this topic has been covered in a couple of...
this topic has been covered in a couple of threads - including this one (https://www.unix.com/unix-for-beginners-questions-and-answers/282022-ksh-how-get-name-script-when-same-script.html).
Also...
812
Posted By vgersh99
first off: #!/bin/ksh secondly, where do you...
first off: #!/bin/ksh
secondly, where do you expect your DAS_VetFed.txt file to be? Looks like the working dir where the script was invoked from.
But then I see:
dir=/mydirectory
cd $dir
So I'd...
1,140
Posted By vgersh99
how about (for starters): awk -v...
how about (for starters):

awk -v str='x*.com' '$1~str && !a[$1]++' myFile
796
Posted By vgersh99
Strange... Given your sample input in post#1...
Strange...
Given your sample input in post#1 and using RudiC's code, I get:

{"NAME":"QLogic 570x/571x Gigabit Ethernet Driver",
"VERSION":"11.11,REV=2009.11.11",
"BASEDIR":"/"}
{"NAME":"QLogic...
779
Posted By vgersh99
why are you using total in 2 diff context? ...
why are you using total in 2 diff context?
total[$1] += $5
and
total=Homework+Lab+Final+Quiz+Survey
Also sum[$1] += $4 is indexed by a single index - not by $1$2
567
Posted By vgersh99
man crontab yields (among others): The...
man crontab yields (among others):

The "sixth" field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or % character,
will be...
370
Posted By vgersh99
how about this for the starters: find ....
how about this for the starters:

find . -type f -name '*.*' | awk -F. '{a[$NF]++} END {for (i in a) print FS i ": " a[i]}'
868
Posted By vgersh99
awk -F'[;]' '{ t[$1 OFS $2]+=$3 } END { for (i in...
awk -F'[;]' '{ t[$1 OFS $2]+=$3 } END { for (i in t) print i, t[i] }' myFile
For the 'Also' part... please post sample representative input.
1,593
Posted By vgersh99
this is gawk specific AND it does not count the...
this is gawk specific AND it does not count the unique lines correctly.
How about another version:

gawk '{l[$0]++} ENDFILE {for (i in l) {if (l[i]==1) u++;t+=l[i]} print t, u, FILENAME; delete l;...
1,593
Posted By vgersh99
how about this: #!/bin/ksh wc -l * |...
how about this:

#!/bin/ksh

wc -l * | sed '$d' | sort | while read lines file junk
do
echo $lines $(sort < $file | uniq -u |wc -l) $file
done
3,072
Posted By vgersh99
MY_DIR="/storage/tmp" awk -v myDir="${MY_DIR}"...
MY_DIR="/storage/tmp"
awk -v myDir="${MY_DIR}" '{if ($1 == "aaa") out=(myDir "/group_a.gtf"); else if ($7 == "bbb") out=(myDir "/group_b.gtf"); print >> out;close(out)} ' infile
565
Posted By vgersh99
I had the same issue/question awhile back... ...
I had the same issue/question awhile back...
After a bit of digging, I installed mksh which "links/hides" itself as ksh:

$ which ksh
/usr/bin/ksh

$ ls -lrt /usr/bin/ksh
lrwxrwxrwx 1...
109
Posted By vgersh99
if you searched for transpose you'd have found a...
if you searched for transpose you'd have found a couple of leads...
awk -F, -f bomb.awk OFS=, myFile where bomb.awk is:

{for(i=1;i<=NF;i++){a[i,NR]=$i};m=NF;n=NR}
END {
for(j=1;j<=m;j++)
...
1,904
Posted By vgersh99
My previously posted attempt was for the provided...
My previously posted attempt was for the provided sample files ONLY - 2 lines for each sequence: 1 header and 1 "data" lines.
Had the OP elaborated on the possible other sample data files, an...
1,904
Posted By vgersh99
not sure if I follow your samples and the desired...
not sure if I follow your samples and the desired output, but I think you might want this.

awk -f dinesh.awk file2 file1 where dinesh.awk is:

FNR==NR {
if (FNR%2)
head=$0
else
...
1,785
Posted By vgersh99
Just to quote RudiC: A desired output would...
Just to quote RudiC:

A desired output would be helpful as well....
Also, you've been asked to start using code tags when posting code/data sample...
1,605
Posted By vgersh99
a bit of a "shot in the dark - different results...
a bit of a "shot in the dark - different results as I believe the description doesn't jive with the sample data.
awk -f bleed.awk myFile where bleed.awk is:

BEGIN {
FS=OFS=","
}
{
...
103,685
Posted By vgersh99
awk -F":" -v OFS=',' '{print $1, $2, 9}'...
awk -F":" -v OFS=',' '{print $1, $2, 9}' fname
1,979
Posted By vgersh99
This is way too vague of a request. Define...
This is way too vague of a request.
Define "nothing happens" and share your tar cfvz.
1,392
Posted By vgersh99
something along these lines: sed 's/^...
something along these lines:

sed 's/^ *\([0-9][0-9]*\).*\(TSval.*\)/\1 \2/' myFile

1> Why does [0-9] need to be grouped into brackers?
[0-9] - signifies the character rang - in this case...
Showing results 1 to 25 of 500

 
All times are GMT -4. The time now is 02:39 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy