10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I created a awk state to calculate the number of success however when the query runs it has a leading zero. Any ideas on how to remove the leading zero from the calculation?
Here is my query:
cat myfile.log | grep | awk '{print $2,$3,$7,$11,$15,$19,$23,$27,$31,$35($19/$15*100)}'
02:00:00... (1 Reply)
Discussion started by: bizomb
1 Replies
2. Shell Programming and Scripting
I am trying to escape single quote in awk, but could not:
awk ' BEGIN{ fstr="COMPRESS('Y','N')" }
{
substr($1,len-3,4)~/_IND/
len=length($1)
if(substr($1,len-3,4)~/_IND/)
printf("%-32s%-14s%-5s%-14s\n",$1,$2,$3,$fstr,$4,$5,$6,$7)
}
' tt.txt > out.log
Error:
awk: Field... (8 Replies)
Discussion started by: ysvsr1
8 Replies
3. Shell Programming and Scripting
I tried to parse data from switch configuration files
vlan 1727 name SQ5506-15 by port
tagged ethe 8/1 to 8/2
untagged ethe 1/13
!
vlan 2105 name SQ5620-7007(BR2) by port
tagged ethe 8/1 to 8/2
untagged ethe 1/17
!
interface ethernet 1/13
port-name SQ5506-15.nic0
rate-limit... (2 Replies)
Discussion started by: winggundamth
2 Replies
4. Shell Programming and Scripting
I have a file that is a log file for web traffic. I would like to convert the timestamp in it to unix time or epoch time.
I am using the date command in conjunction with awk to try to do this. Just
myfile:
28/Aug/1995:00:00:38 1 /pub/atomicbk/catalog/home.gif 813
28/Aug/1995:00:00:38 1... (3 Replies)
Discussion started by: jontjioe
3 Replies
5. Shell Programming and Scripting
I'm using awk '{print $1}' and it works most of the time to print the contents of a mysql query loop, but occationally I get a field with some special character in it, is there a way to tell awk to ignore all special characters between my FS? I have >186K records, so building a list of ALL special... (6 Replies)
Discussion started by: unclecameron
6 Replies
6. Shell Programming and Scripting
ll|awk '{print "INSERT INTO SCHEMA.TABLE_NAME VALUES (`"$9 "`,"$5");" }'
INSERT INTO SCHEMA.TABLE_NAME VALUES (``,);
INSERT INTO SCHEMA.TABLE_NAME VALUES (`TABLE_PARTITION_Y2010M03D06.dmp`,7923328);
INSERT INTO SCHEMA.TABLE_NAME VALUES (`TABLE_PARTITION_Y2010M03D06.log`,1389);
But I want ' in... (2 Replies)
Discussion started by: faruque.ahmed
2 Replies
7. Shell Programming and Scripting
Hi Everyone!
I want to build sql inserts from a list of countries/regions saved in a file. The list looks like this:
United Kingdom
Czech Republic
...
The script I run is:
while read i;
do
var=`expr $var + 1`;
echo "INSERT INTO calltypes VALUES($var, '$i','$i');" >>... (5 Replies)
Discussion started by: linuca
5 Replies
8. Shell Programming and Scripting
The following statement does work. But the second command does not work as expected.
ssh root@123.123.123.123 \\"mysqldump -h localhost -u root -pPassWord dbName -d | gzip -cf\\" | gunzip -c > database1.sql
ssh root@123.123.123.123 \\"mysqlbinlog /var/log/mysql/mysql-bin.*... (0 Replies)
Discussion started by: shantanuo
0 Replies
9. Shell Programming and Scripting
I have a file with the following contents
# more hello.txt
man
hello man
whereru
The shell script i have tries to echo the contents of the file hello.txt
for i in `cat hello.txt`
do
echo $i
done
but the output i am getting is taking the space as a new line..
#... (3 Replies)
Discussion started by: Tuxidow
3 Replies
10. Shell Programming and Scripting
Hi
I'm trying to split a dir listing
eg
/home/foo1/foo2
I'm using ksh
I've tried
dir=/home/foo1/foo2
splitit=`echo $dir | awk -F '\/' '{print $1}'`
echo $splitit
nothing is output!
I have checked the escape character. The only one I have found is \
BTW `pwd` | awk -F \/... (8 Replies)
Discussion started by: OFFSIHR
8 Replies