Visit The New, Modern Unix Linux Community

Search Results

Search: Posts Made By: Ygor
18,377
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}'
43,401
Posted By Ygor
Use perl... perl -pi -e...
Use perl...

perl -pi -e 's/pattern/replacement/g' file1
24,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
106,414
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...
89,467
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...
36,008
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).
1,596
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

$
12,002
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.
958
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'|'...
10,740
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
31,480
Posted By Ygor
Try... echo $var|awk '{print int($1+0.5)}'
Try... echo $var|awk '{print int($1+0.5)}'
3,023
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
35,353
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
21,168
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...
1,431
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
7,490
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
1,381
Posted By Ygor
See... https://www.unix.com/302098992-post2.html
See... https://www.unix.com/302098992-post2.html
684
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...
3,481
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:...
3,481
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];')
1,626
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
19,710
Posted By Ygor
Just pipe the ls through the awk command as...
Just pipe the ls through the awk command as posted by NareshN
38,862
Posted By Ygor
Try...sed -n '1p;$p' file1
Try...sed -n '1p;$p' file1
664
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,032
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

 

Featured Tech Videos

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