Search Results

Search: Posts Made By: skar_a
4,660
Posted By skar_a
Sendmail: Remove domain name from From mail id
While sending mails using sendmail, the domain name is getting appended to the from id. My requirement is not to have that domain name in the From mail id. Could anyone help me on this? I am using...
3,914
Posted By skar_a
If I understand your question correctly, you want...
If I understand your question correctly, you want to search for the date in time.out and if it is present, update it with the line from runtime.out or append to time.out, you may try the below code:...
4,049
Posted By skar_a
If you are sure that the error lines will always...
If you are sure that the error lines will always have an INFO at the end, you may use:

awk '/ERROR/,/INFO/{ if( $0 !~ /INFO/ )print }' infile
2,293
Posted By skar_a
For first field: grep '^num1' infile For...
For first field:

grep '^num1' infile
For third field:

grep '^[^ ]* [^ ]* num3' infile
Or better, use awk:

awk '{ if($3 == num3 ) print }' infile
1,918
Posted By skar_a
Try sorting the files and use comm: comm -23...
Try sorting the files and use comm:

comm -23 file100k File5k
3,869
Posted By skar_a
You can use awk for this. $ awk...
You can use awk for this.

$ awk '{if(arr[$2]=="")arr[$2]=$0; else{split(arr[$2],tmp);if($8>tmp[8]) sub(/tmp[8]$/,arr[$2],$8);}}END{for(item in arr) print arr[item]}' infile
46 CU 1992 8 29 ...
3,524
Posted By skar_a
Try this: awk '/^>/{if(hdr=="")...
Try this:

awk '/^>/{if(hdr=="") hdr=$0}/^[^>]/{x[$0]++;if(x[$0]==1) {print hdr;print} hdr=""}' infile
5,106
Posted By skar_a
awk '{ if( NR == 1 ) start=$1;if(NR != 1 && $1 !=...
awk '{ if( NR == 1 ) start=$1;if(NR != 1 && $1 != (prev+1)) {print start,prev;start=$1;}prev=$1}END{print start,prev}' infile
1,485
Posted By skar_a
The awk command in your code is printing version...
The awk command in your code is printing version and run_id in seperate lines. So the read command cannot get these values into two variables(it will work only if both values are in the same line)....
4,595
Posted By skar_a
psql -U postgres -c "create database dbname" if...
psql -U postgres -c "create database dbname"
if [ $? -eq 0 ];then
echo OK
else
echo Not OK
fi
3,142
Posted By skar_a
$ nawk...
$ nawk '{gsub(/:/,"",st);gsub(/:/,"",et);gsub(/:/,"",$2);if($2>=st && $2<=et) print }' st=09:33:40 et=09:33:58 infile
2009/01/19 093340 --> ---ORA-28817: PL/SQL function returned an error....
63,340
Posted By skar_a
echo "/home/test/blah/blah"|grep '/$' if [$?...
echo "/home/test/blah/blah"|grep '/$'
if [$? -eq 0];then
echo "Ends with /"
fi
26,910
Posted By skar_a
I think you want to actually edit the file...
I think you want to actually edit the file itself. The command given by user agn should work but it will not modify the file. You can redirect the output to a temp file and then rename it.
cut -f...
4,812
Posted By skar_a
Which character do you use to indent? space or...
Which character do you use to indent? space or tab..you need to use that char after the ^ in the reg exp.

grep -v '^ ' filename
12,081
Posted By skar_a
You can use the -p option of ls command which...
You can use the -p option of ls command which marks directories with a slash at end.

ls -p|sed -n 's#/$##p'
2,311
Posted By skar_a
$ cat infile Locking for access COPDB.T1 ...
$ cat infile
Locking for access COPDB.T1
insert into COPDB.T2 select * from COPDB.T5
update COPDB.T3 set................
insert into COPDB.T7 select * from COPDB.T12
update COPDB.T71...
3,431
Posted By skar_a
You can use grep to search for lines not having -...
You can use grep to search for lines not having - in its first five positions and use -v option to print all other lines(i.e lines having - in first five chars)

$ cat t
ab-cd jan-09
ddddd jan09...
1,443
Posted By skar_a
echo '31-Jan-2008'|tr '[a-z]' '[A-Z]'|sed...
echo '31-Jan-2008'|tr '[a-z]' '[A-Z]'|sed 's/-//g;s/JAN/01/;s/FEB/02/;s/MAR/03/;s/APR/04/;s/MAY/05/;s/JUN/06/;s/JUL/07/;s/AUG/08/;s/SEP/09/;s/OCT/10/;s/NOV/11/;s/DEC/12/;'
Showing results 1 to 18 of 18

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