I have a line
EXTDIR=`echo $i | sed 's/\-tar.gz//'`
which looks for files ending in -tar.gz, i would like to increase the functionality so that it looks for .tar.gz files as well as -tar.gz. Do i put the - in square brackets with a dot ? like this
EXTDIR=`echo $i | sed 's/\tar.gz//'`
... (1 Reply)
hey,
Im just wondering is there away to get sed to read from a variable
eg
it doesn't seem to work, i really need to be able to recursively change the same data set... (2 Replies)
I have some text:
0400-0427 NA Czech Republic R. Prague 5990ca, 6200, 7345
0400-0456 NA, As Romania R. Romania Int'l 6115, 9515, 9690,
11895
0400-0500 NA U. S. A. WYFR 6065, 6855, 9505,
9715
0400-0500 NA,Eu,Af U. S. A. ... (8 Replies)
Ok. I'm just starting to use AWK and I have a question. Here's what I'm trying to do:
uname -n returns the following on my box:
ftsdt-svsi20.si.sandbox.com
I want to pipe this to an AWK statement and make it only print:
svsi20
I tried:
uname -n | awk '{ FS = "." ; print $1 }'
... (5 Replies)
Hello,
I have the following line in one of my shell scripts. It works fine when the search string($SERACH_STR) exists in the logfile($ALERTLOG) but if the search string does not exist this line errors out at run time. Is there a way to make this line return 0 if it is not able to find the... (4 Replies)
Unix Guru's ,
I have a file all_files.txt containing data as follows
all_files.txt
first file : /a/b/c/file.sh first second CLIENT1
second file : /a/b/c/file.sh first second CLIENT1
first file : /a/b/c/file.sh first second CLIENT2
second file : /a/b/c/file.sh first second... (6 Replies)
Just want to know why when I do the following in sed, the required is not extracted.
echo "ab01cde234" | sed 's/*$//'
result: ab01cde (Which is correct)
echo "ab01cde234" |sed 's/.*\(*\)$/\1/'
result: blank (was expecting 234)
or
echo "ab01cde234" |sed 's/.*\(\)*$/\1/'
result: blank... (6 Replies)
Hi Guru's.
I am trying to use to check if $5 is greater than 80 & if not 100, then to print $0 :
awk '{ if ($5>80) && if ($5 != 100) print $0}
But getting error:
>bdf1|sed 's/%//g'|awk '{ if ($5>80) && if ($5 != 100) print $0}'
syntax error The source line is 1.
The error... (6 Replies)
How to write in awk to remove lines starting with "#" and then process the file:
This is not working:
cat file|awk '{if ($0 ~ /^#/) $0="";print NF>0}'
When I just give cat file|awk '{if ($0 ~ /^#/) $0="";print }'
it prints the blank lines . I don't wnat the blank lines along with the... (15 Replies)
gawk 'BEGIN{count=0} /^Jan 5 04:33/,0 && /fail/ && /09x83377/ { count++ } END { print count }' /var/log/syslog
what is wrong with this code? i want to search the strings "fail" and "09x83377" from all entries. im grabbing all entries in the log starting from Jan 5 04:33 to the end of the... (3 Replies)