Search Results

Search: Posts Made By: vgersh99
73
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...
390
Posted By vgersh99
how about (for starters): awk -v...
how about (for starters):

awk -v str='x*.com' '$1~str && !a[$1]++' myFile
679
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...
656
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
493
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...
326
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]}'
768
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,569
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,569
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
436
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...
2,993
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
102
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,888
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,888
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,773
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,595
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=","
}
{
...
1,947
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,822
Posted By vgersh99
Please define/describe doesn't work. What is it...
Please define/describe doesn't work.
What is it that you're trying to do exactly and in what way it "fails"?
3,586
Posted By vgersh99
man crontab yields : The ``sixth'' field...
man crontab yields :

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...
1,382
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...
1,593
Posted By vgersh99
a bit verbose, but try: awk -f rag.awk file1...
a bit verbose, but try: awk -f rag.awk file1 file2 where rag.awk is:

BEGIN {
FS=OFS=","
}
{idx=$1 OFS $2; _34=$3 OFS $4}
FNR==NR {if (FNR>1) f1[idx]=_34; next}
idx in f1 { print idx,...
2,168
Posted By vgersh99
Well, I did remember discussing something similar...
Well, I did remember discussing something similar in the past - here's the relevant thread (https://www.unix.com/shell-programming-and-scripting/206345-bourne-0-issues-when-sourcing-files.html).
...
2,168
Posted By vgersh99
how about this approach [covering bash/ksh -...
how about this approach [covering bash/ksh - might need to enhance it for other (zsh/sh/etc)]

#!/bin/ksh
#set -x

#echo "\$0 ->[${0}] \$# -> [${#}] \$_ -> [${_}] "
case "${0}" in
-bash)...
1,836
Posted By vgersh99
to start with... tar cvf bulkArchive.tar...
to start with...
tar cvf bulkArchive.tar expla*.gz
1,836
Posted By vgersh99
would looking into man tar be helpful?
would looking into man tar be helpful?
Showing results 1 to 25 of 500

 

Featured Tech Videos

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