Search Results

Search: Posts Made By: amazigh42
1,136
Posted By Don Cragun
So you want: log_name="server.log...
So you want:
log_name="server.log server.log.$AAAA_MM_JJ.[0-9][0-9][0-9]"
in your script sometime after you have set the variable AAAA_MM_JJ.
3,007
Posted By Corona688
${DATE:0:1} that's a substring operator -- the...
${DATE:0:1} that's a substring operator -- the variable, the offset, and the length. An offset of 0 and length of 1 gets the first character.

To only process valid lines:
valid () {
...
}
...
1,178
Posted By alister
To be pedantic: those patterns are not regular...
To be pedantic: those patterns are not regular expressions. It's just sh pattern matching notation.

To be helpful: use multiple patterns.
case "$3" in
([01][0-9] | 2[0-3])
# Nothing, OK !
...
3,330
Posted By DGPickett
'case' is the oldest, most portable pattern...
'case' is the oldest, most portable pattern check. Use (..) on patterns so vi's '%' can track/traverse them:case "$1" in
([a-z][a-z][a-z][a-z])
# nothing, OK !
;;
(*)
echo 'Fatal, $1 =...
3,330
Posted By RudiC
Again, be aware that arg n may NOT be set! Add...
Again, be aware that arg n may NOT be set!
Add this to your f1 function for testing the other parameters:[[ "$2" -ge "0" && "$2" -le "23" ]] && echo \$2 is good || echo \$2 is bad
[[ "$3" -ge "0"...
3,774
Posted By RudiC
Try find ./temp ./TMP -iname "$nom" ...
Try find ./temp ./TMP -iname "$nom" ...
3,774
Posted By RudiC
It's a bit tricky to get values back to your main...
It's a bit tricky to get values back to your main script from subshells, and pipes are running in subshells. You can try this one that will save a good result in a variable for use outside the loop...
3,039
Posted By RudiC
Rats! Sorry for that. I should never give out any...
Rats! Sorry for that. I should never give out any code without thoroughly testing it - even small "corrections" on the fly will come flying in my face!
Drop the shift and make the next line read ...
4,130
Posted By MadeInGermany
if [ -f $file.gz ] then command="gunzip...
if [ -f $file.gz ]
then command="gunzip -c"
else command=cat
fi1. You do want to test for $file.gz, don't you.
2. The shell [ ] wants a space on both sides. If you like you can...
4,130
Posted By Chubler_XL
Here I want to use any of the following single...
Here I want to use any of the following single characters as field seperators: /, [, ] or space.

This equates to the regular expression [/ \][] (just like [ABC] would allow a single A, B or C...
4,130
Posted By Chubler_XL
This should correct the "[" and "]" chars around...
This should correct the "[" and "]" chars around the data and time line.

file=$1
if [ -f $file.gz ]
then command="gunzip -c"
else command=cat
fi
$command $file | awk -F"[/ \\\][]"...
Showing results 1 to 11 of 11

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