Search Results

Search: Posts Made By: Ygor
25,827
Posted By Ygor
Or use the exit function in awk to exit...
Or use the exit function in awk to exit immediately, e.g...

awk '/pattern/ {print; count++; if (count=2000) exit}'
60,086
Posted By Ygor
Use perl... perl -pi -e...
Use perl...

perl -pi -e 's/pattern/replacement/g' file1
29,700
Posted By Ygor
What did you try? What shell are you using? This...
What did you try? What shell are you using? This is bash, but should also work in ksh...printf '%s%20s\n' $(date '+%Y%m%d') $(wc -l < a.dat) > a.ctl
136,653
Posted By Ygor
This is a script I have to send html mail with a...
This is a script I have to send html mail with a pdf attachment...#!/usr/bin/ksh

export MAILTO="spam@ebay.com"
export SUBJECT="Mail Subject"
export BODY="/tmp/email_body.html"
export...
109,420
Posted By Ygor
You should look at the manual pages for sendmail....
You should look at the manual pages for sendmail. I have only included the bare minimum to get you started. You can add headers like "To:", "Cc:", "Bcc:", "Apparently-To:", etc. This can be done...
46,179
Posted By Ygor
The Advanced Bash-Scripting Guide has some...
The Advanced Bash-Scripting Guide has some exercises (http://www.tldp.org/LDP/abs/html/exercises.html).
2,628
Posted By Ygor
Try something like...$ string1='3X' $ case...
Try something like...$ string1='3X'

$ case $string1 in [0-9][0-9]) : ;; [0-9]?) string1=${string1:0:1} ;; esac

$ echo $string1
3

$
17,918
Posted By Ygor
To execute the block, you need to have a slash /...
To execute the block, you need to have a slash / on a line of its own, after the END; line.
1,885
Posted By Ygor
Try...$ cat file1 Tom|london Tom|london ...
Try...$ cat file1
Tom|london
Tom|london
Tom|Paris
Adam|Madrid
Adam|NY
Tom|amsterdam
Tom|amsterdam
Tom|amsterdam
Tom|amsterdam

$ awk -F'|'...
12,408
Posted By Ygor
You can just use sed....sed '/PATTERN/s/ to be...
You can just use sed....sed '/PATTERN/s/ to be changed/, YEHA! to be changed/' FILENAME
37,832
Posted By Ygor
Try... echo $var|awk '{print int($1+0.5)}'
Try... echo $var|awk '{print int($1+0.5)}'
4,069
Posted By Ygor
You could also use the shell built-in variable...
You could also use the shell built-in variable $SECONDS

#!/bin/sh
START=$SECONDS
:
#script commands go here
:
END=$SECONDS
echo elapsed time is $((END-START)) seconds
43,999
Posted By Ygor
This will remove blank lines and those which only...
This will remove blank lines and those which only contain spaces...

grep -v '^ *$' $files

If you wanted to use sed, then...

sed '/^ *$/d' $files
27,662
Posted By Ygor
I think that you will have to use sendmail...
I think that you will have to use sendmail instead of mailx to send inline html, e.g....
#!/usr/bin/ksh

export MAILTO="me@work"
export CONTENT="filename.out"
export SUBJECT="Subject"
(
echo...
2,451
Posted By Ygor
In bash, variables are local to pipes. ...
In bash, variables are local to pipes.

Replacecat file | while read line
do
:
done
Withwhile read line
do
:
done < file
9,703
Posted By Ygor
I thought that file ownership is just a user ID...
I thought that file ownership is just a user ID number, which you can see using ls -ln
2,321
Posted By Ygor
See... https://www.unix.com/302098992-post2.html
See... https://www.unix.com/302098992-post2.html
1,279
Posted By Ygor
Oh I see the problem. $1 and $2 are local to...
Oh I see the problem. $1 and $2 are local to functions but you are not passing parameters to the function. Perhaps define a and b outside of the functions, e.g...$ cat sh.1
menu ()
{
echo...
7,055
Posted By Ygor
The time zone "trick" is not a reliable method of...
The time zone "trick" is not a reliable method of performing date arithmetic.

Have a look at the FAQ:...
7,055
Posted By Ygor
For datecalc, I think there are examples in the...
For datecalc, I think there are examples in the FAQ.

If you have perl, perhaps try...DATE3=$(perl -e '@f=localtime(time-(86400*7));printf "%02d%02d%02d\n",$f[5]%100,$f[4]+1,$f[3];')
3,034
Posted By Ygor
Try...$ head file[12] ==> file1 <== 999 111...
Try...$ head file[12]
==> file1 <==
999
111
222
333
111
444

==> file2 <==
555
000

$ awk '/111/&&!c++{$0=$0 s};1' s="$(<file2)" file1
999
111 555
000
222
333
111
Forum: HP-UX 09-06-2012
29,097
Posted By Ygor
Just pipe the ls through the awk command as...
Just pipe the ls through the awk command as posted by NareshN
53,327
Posted By Ygor
Try...sed -n '1p;$p' file1
Try...sed -n '1p;$p' file1
1,000
Posted By Ygor
This should work for any size...$ cat file1.txt ...
This should work for any size...$ cat file1.txt
var1 var2 var3 var4 var5 var6
A G A T G T
G A A A A A
A A A A A A
G A G T A T

$ awk 'NR == 1 {
split($0, var, FS)
...
2,996
Posted By Ygor
Perhaps try md5sum, e.g...md5sum -t files* | awk...
Perhaps try md5sum, e.g...md5sum -t files* | awk 'a[$1]{printf "%s and %s are the same\n",a[$1],$2;next}{a[$1]=$2}'
Showing results 1 to 25 of 98

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