Search Results

Search: Posts Made By: CaapAjayShukla
12,213
Posted By CaapAjayShukla
Dear ygemici, Can you explain what awk is...
Dear ygemici,
Can you explain what awk is doing.

Thanks in Advance.
Regards,
Ajay
1,779
Posted By CaapAjayShukla
Just write after read statement /usr/bin/sed...
Just write after read statement
/usr/bin/sed 's/$TYPE/'$TYPE'/' file2 > file3 and then you can [cat]/print the file.
3,298
Posted By CaapAjayShukla
Try this
/usr/xpg4/bin/awk -F" " '{
if (NR ==2)
{print $1 " " $2}
}' filename


This code will give output as below
SYSTEM SYSTEM
quarantine quarantine
nigel Nigel...
1,429
Posted By CaapAjayShukla
what will be the format of temperature file.
what will be the format of temperature file.
2,412
Posted By CaapAjayShukla
Check your Sql file
First Check for your sql file whether it is running properly or not and second thing if it is not printing echo 'Hi' written after ECHO then how the control is coming to grep stmt.
2,224
Posted By CaapAjayShukla
You can use below code
/usr/xpg4/bin/awk 'BEGIN{t1="";t2="";t3="";}{if($0 ~ /Buy/) t1=$4 }{if($0 ~ /Sell/) t2=$4}{if ($0 ~ /Server/) t3=$2} END{prin
t t1,t2,t3}' file1


You will get output as below
175 212 sepo2
5,836
Posted By CaapAjayShukla
Thanks man.
Thanks man but one query that only print is a default command or any thing else?
2,395
Posted By CaapAjayShukla
Thanks methyl
Thanks methyl for making all points clear, Really appreciate.
5,836
Posted By CaapAjayShukla
what does 1 means in your code
Hi Rad,
I am new to awk,
Pls tell me what does mean by 1 at end in your code

echo 1 2 3 4 5 6 | /usr/xpg4/bin/awk '{if( NF > 2) { $3 = RS $3}}1'
2,395
Posted By CaapAjayShukla
correct read statement
Instead read $input try read input.
4,341
Posted By CaapAjayShukla
another method as below
/usr/xpg4/bin/awk 'BEGIN {t1="";t2="";t3="";t4="";}
{ if ($1 ~ /TJ/ && $2 ~ /DETY/ ) { t1=$1; t2=$2; next; } }
{ if ($3 ~ /SP/) { t3=$3; next; } }
{ if($1 ~ /MGG/) { t4=$1; next; } }
{ if($1 ~...
2,886
Posted By CaapAjayShukla
Thanks man I think it will work. Really Thanks
I don't seem to understand the requirement too,
if you want to trim the white space characters at the end of each line, just enable trimspool:

set trimspool on
2,886
Posted By CaapAjayShukla
Sorry man, But I think you have not understand my...
Sorry man, But I think you have not understand my prob properly.
Let me explain u.
I have already set the lin size as 500 so what ever line is coming from table they all have same lenght as 500...
4,051
Posted By CaapAjayShukla
I don't think awk can recognize number.
This will give 0 0 0 only.substr is required.
4,051
Posted By CaapAjayShukla
Use below code
Use below code

awk ' BEGIN {toth=0;totm=0;tots=0;}{
toth=toth+substr($2,1,2);
totm=totm+substr($3,1,2);
tots=tots+substr($4,1,2);}
END{print "Total Hours : " toth ;
print "Total Min : " totm...
2,886
Posted By CaapAjayShukla
Not Working, Still having same output
Thanks for reply, but this is not working and giving same output.
2,886
Posted By CaapAjayShukla
How to use awk for printing line from database table?
Hi ,
I have inserted some records in a table having column "value1 varchar2(4000)" and want to spool in a file.
I have written as below

set echo off
set feed off
set hea off
set wra off
set...
Showing results 1 to 17 of 17

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