Search Results

Search: Posts Made By: RudiC
166
Posted By RudiC
How about echo /dir1/dir2/dir3/$(date...
How about
echo /dir1/dir2/dir3/$(date +"%Y/%m/%d")/init* | wc -w
321
Posted By RudiC
A little clumsy as you have to take care for...
A little clumsy as you have to take care for every single special case - may benefit from some polishing:
awk '
BEGIN {PAT = "<<[^>]*>>"
}

{match ($0, PAT)
NXT =...
411
Posted By RudiC
Well, then, try TMP=$(find /where/so/ever...
Well, then, try
TMP=$(find /where/so/ever -iname "*bootstrap*"); case ${TMP##*_} in (green) echo "is green";; (red) echo "is red";; (*) echo "is missing";; esac


You could, of course, also use...
411
Posted By RudiC
Do the two file versions coexist, or is there one...
Do the two file versions coexist, or is there one single file max?
And, why a one liner? What be the benefit thereof?
244
Posted By RudiC
Please take care when formulating your request....
Please take care when formulating your request. Misleading specifications may lead to unsatisfactory proposals.





Try
if ls "$dir"/[Ff]ile[Oo]ne.csv > /dev/null 2>&1
then echo "File...
194
Posted By RudiC
I get the same results as you do applying your...
I get the same results as you do applying your script to your sample data. But, not knowing WHAT formula to apply under which conditions, I can't tell "what (you're) ... doing is right." And, I'm...
244
Posted By RudiC
Don't understand. Above will echo "File not...
Don't understand. Above will echo "File not found!" if any file name beginning with fileone.csv exists in dir, like
fileone.csv
fileone.csv12
fileone.csvacbdefaj
fileone.csv_sdfwegf If none of...
331
Posted By RudiC
Difficult to believe. Any error messages? is dir...
Difficult to believe. Any error messages? is dir exported / defined (within the script)?


Try also
stat -c"the current csv is from: %y" *.csv | sort -r -k6,6 | head -1
291
Posted By RudiC
It's not the for cycle's feature but the way the...
It's not the for cycle's feature but the way the shell expands the "glob"s using "pattern matching". man bash is your friend:

For any other arrangement of the value list, additional measures...
430
Posted By RudiC
How about awk -F, ' FNR == 1 {FCNT++ ...
How about
awk -F, '
FNR == 1 {FCNT++
}
FNR > 1 {KEYS[$1]
for (i=2; i<=NF; i++) W[$1,FCNT,i] = $i
}
END {printf...
332
Posted By RudiC
For the easy case that your replacements are in...
For the easy case that your replacements are in lines in increasing order, try
awk 'FNR==NR {REP[NR] = $2; next} /^>/ {$0 = ">" REP[++CNT]}1' FS="=" list.txt gene1.fasta
>org5
ATGTAGC
>amylase...
347
Posted By RudiC
man awk: The match searches $0 for your...
man awk:

The match searches $0 for your target string PCX..._1 (the ellipsis replaced by [^_]*, i.e. non-"_" characters), and, if found, sets RSTART and RLENGTH accordingly for immediate use by...
629
Posted By RudiC
Hmmm - I missed to post the necessary IFS...
Hmmm - I missed to post the necessary IFS modification. Try again with this slightly modified version:
IFS=$'\n'

for IN in $(echo "${!ENTRIES
}" | tr ',' '\n' | sort -un)
do [ !...
356
Posted By RudiC
There seems to be a mixup between shell globs and...
There seems to be a mixup between shell globs and grep / regex patterns. Try grep 'body.*.xml'.


Or, recent bashes provide "extended pattern matching" if the extglob shell option is set:
shopt...
347
Posted By RudiC
How about awk '/PROTOBUF_DIRS/ && match ($0,...
How about
awk '/PROTOBUF_DIRS/ && match ($0, /PXC[^_]*_1/) {print substr ($0, RSTART, RLENGTH)}' *.spec *.mkawk unfortunately lacks both the -r (--recursive) and the --include options that grep...
497
Posted By RudiC
I'm afraid, no. You've been shown in your other...
I'm afraid, no. You've been shown in your other thread (https://www.unix.com/303040608-post2.html) that division by 0 is possible in your context and the reason therefor. And, looking at your sample...
144
Posted By RudiC
Please answer the questions raised by Peasant. ...
Please answer the questions raised by Peasant.



All sed command operate on the pattern space; hold space is just a bucket for intermediate storage. Your code snippet swaps the line just read...
Forum: Shell Programming and Scripting 2 Weeks Ago
493
Posted By RudiC
How about grep -o...
How about
grep -o 'filename-[[:digit:].]*.tar.gz' file
filename-1.0.0.tar.gz
554
Posted By RudiC
Would this come close? grep -offile1 file2 |...
Would this come close?

grep -offile1 file2 | sort | uniq -c
2 god
1 pod
2 rod

--- Post updated at 16:24 ---

Hoppla - didn't take your thread title into account. Try this...
514
Posted By RudiC
Not sure I understand your request. Does this...
Not sure I understand your request. Does this work for your scenario 1 2?
echo "${STRING//,/$'\n'}" | awk -F: 'FNR==NR {T[$1,$2] = $0; next} ($1,$2) in T {$0 = T[$1,$2]} 1' - file
478
Posted By RudiC
How about lsblk -r -oname? From man lsblk:
How about
lsblk -r -oname? From man lsblk:
Forum: Shell Programming and Scripting 2 Weeks Ago
329
Posted By RudiC
Close to impossible. If installed and on the...
Close to impossible. If installed and on the PATH, bash wouldn't say that.
Forum: Shell Programming and Scripting 2 Weeks Ago
734
Posted By RudiC
NA was not specified. Try awk -F/ ' NR == 1 ...
NA was not specified. Try
awk -F/ '
NR == 1 {printf "Sl#,VideoName,BitRate"
}
FNR == NR {PRM[NR] = "( |no-)" $0 "=*[^ /]*"
MX = NR
...
Forum: Shell Programming and Scripting 2 Weeks Ago
734
Posted By RudiC
Try awk -F/ ' NR == 1 {printf...
Try
awk -F/ '
NR == 1 {printf "Sl#,VideoName,BitRate"
}
FNR == NR {PRM[NR] = "( |no-)" $0 "=*[^ /]*"
MX = NR
printf ",%s", $0
...
565
Posted By RudiC
In the END section, you're using b as the loop...
In the END section, you're using b as the loop variable but use $1 for building the indices. Won't fly.
And, if one or more of the categories don't exist for a student, their total array element...
Showing results 1 to 25 of 500

 

Featured Tech Videos

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