Search Results

Search: Posts Made By: RudiC
151
Posted By RudiC
No surprise. If the grep "command substitution"...
No surprise. If the grep "command substitution" delivers the "empty" value, ls-l uses the default: . . man ls:

Add a certainly non-existent file name (difficult to find, as there are almost no...
218
Posted By RudiC
In your first script, you're both too generous,...
In your first script, you're both too generous, and not enough, with "command substitutions". Try
for i in "${SERVICES[@]}"
do pgrep $i >/dev/null
STATS=$?
if [ $STATS == 0 ...
398
Posted By RudiC
I'm helpless with that little context you give....
I'm helpless with that little context you give. What's so special with those files? Does tar work without the gzip? Does it work with other files, e.g simple text files? In another directory? Without...
398
Posted By RudiC
I'm baffled to learn the AIX tar version doesn't...
I'm baffled to learn the AIX tar version doesn't provide the z option.


Writing the tar red output to a file (-f /backup/App_Bckup.tar) will prevent it to write to stdout, i.e. the pipe to...
484
Posted By RudiC
Again: too many escapes. Drop one of the two back...
Again: too many escapes. Drop one of the two back slashes in the read delimiter's -d definition. Same for ALL the escaped double quotes around file and directory names downstream.


Sure your...
484
Posted By RudiC
Drop the escaped double quotes in find's...
Drop the escaped double quotes in find's "starting point". find does allow multiple "starting points", BTW.
484
Posted By RudiC
Hmmm - I don't see...
Hmmm - I don't see /volume1/Archive/IMAGES/UPLOAD/DNG/ referenced anywhere in your script - that error msg can't come from that script. Does the DNG directory exist in the path?
165
Posted By RudiC
That space is the OFS between $1 and $2. Try like...
That space is the OFS between $1 and $2. Try like


awk '
BEGIN {for (i=split("JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC", month); i; i--) mdigit[month[i]] = i
}
{$1 =...
Forum: Shell Programming and Scripting 2 Weeks Ago
546
Posted By RudiC
I can't reproduce that specific error with the...
I can't reproduce that specific error with the script you posted. Sure you posted the correct and complete one?


Two comments:
- The #! token ("shebang") HAS to be the first two chars of a...
478
Posted By RudiC
This MAY work to identify the target files. It...
This MAY work to identify the target files. It produces an archive listing in long format including the date/time stamps, which ($4,$5) then are printed to stdout and a pipe, and, in parallel, the...
478
Posted By RudiC
I'm afraid you're out of luck. Not all tar...
I'm afraid you're out of luck. Not all tar versions provide a --delete option; e.g.

tar --version
bsdtar 2.8.4 - libarchive 2.8.4
doesn't. Those which do, like
tar --version
tar (GNU tar) 1.30...
559
Posted By RudiC
Or awk -F, ' {print $0 FS...
Or
awk -F, '
{print $0 FS substr($NF,($3=="bcd") ? 4 : 9, 1)}
' file
395
Posted By RudiC
Now, where to start? - With your syntax...
Now, where to start?


- With your syntax errors?

Beyond bash: syntax error near unexpected token `else', there are
'[' 100652 -ge 235900 ']' -a '[' 100652 -le 060000 ']'
bash: [: too many...
559
Posted By RudiC
@nezabudka: You are right if the last field is...
@nezabudka: You are right if the last field is well-formed, i.e. >= 4 chars. Compare the versions for the case of last field < 4 char...
Forum: Shell Programming and Scripting 2 Weeks Ago
1,041
Posted By RudiC
Try as given in example above # m h dom...
Try as given in example above


# m h dom mon dow user command
17 * * * * root run-parts --report /etc/cron.hourly


would yield

0 * * * * test /script_path/my_script.sh
559
Posted By RudiC
And, the .* would allow for one or more...
And, the .* would allow for one or more comma-separated fields, both in the middle as well as at line end. You might want to anchor the regex at line end, too. Proposal (untested)


sed -r...
592
Posted By RudiC
The OP specified , that's what the formatted...
The OP specified , that's what the formatted sprintf is for. As the sample data are just 10 byte long, not 12, we need to wait until resolved by the OP, we can just guess. Try this simplified but...
592
Posted By RudiC
Adapting nezabudka's proposal, (untested): ...
Adapting nezabudka's proposal, (untested):


awk '
NR==FNR {pat[$1] = $2
next
}

{$0 = substr ($0, 1, 133) sprintf ("%12s", pat[substr ($0, 134, 12)])...
533
Posted By RudiC
This is a "brace expansion". It is expanded...
This is a "brace expansion". It is expanded before any other expansions, and it cannot take any variables; read man bash very carefully:

Those strings, integers, or characters are constants, not...
637
Posted By RudiC
How about awk -F, -v"FLDS=5,8" ' BEGIN ...
How about
awk -F, -v"FLDS=5,8" '
BEGIN {FCNT = split(FLDS, FLD)
}

function CV(TMP) {Y = int(TMP/1E4)
return sprintf...
342
Posted By RudiC
First thing to do is: get rid of syntax errors...
First thing to do is: get rid of syntax errors in your code.


For your problem, try
tac file | awk '/<type>5/ {T5 = 1} /<alarmsend/ && T5 {sub (/yes/, "no"); T5 = 0} 1' | tac...
1,166
Posted By RudiC
Start with a decent spec in the first place. ...
Start with a decent spec in the first place.


Try
cd files2folders
for FN in *.jpg
do NR="${FN%.*}"
NR="${NR#*_}"
echo mv "$FN" "$NR"*
done
mv 1244081312562_01.jpg...
1,166
Posted By RudiC
After changing directory to "files2folders", the...
After changing directory to "files2folders", the for loop runs across all .jpg files. The "number suffixes" are extracted by means of two shell's "Parameter Expansion / Remove matching prefix...
493
Posted By RudiC
Try awk ' #NR == 1 || $3-ST>2999 ...
Try
awk '
#NR == 1 ||
$3-ST>2999 {FN = "file" ++FCNT
ST = $2
}
{print > FN
}
' file


This assumes the...
533
Posted By RudiC
... is not something people can start analysing /...
... is not something people can start analysing / debugging a problem upon. Nor is your code as presented.


First step is get rid of the syntax errors encountered.

Apply adequate structuring...
Showing results 1 to 25 of 500

 

Featured Tech Videos

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