Search Results

Search: Posts Made By: Ygor
45,773
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).
17,537
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.
2,337
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

$
1,595
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,227
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
9,212
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,156
Posted By Ygor
See... https://www.unix.com/302098992-post2.html
See... https://www.unix.com/302098992-post2.html
1,108
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...
6,261
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];')
6,261
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:...
Forum: HP-UX 09-06-2012
28,926
Posted By Ygor
Just pipe the ls through the awk command as...
Just pipe the ls through the awk command as posted by NareshN
2,864
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
2,902
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}'
1,399
Posted By Ygor
Try...awk 'BEGIN{FS=OFS="\t"}$3~s{$6=r}1'...
Try...awk 'BEGIN{FS=OFS="\t"}$3~s{$6=r}1' s='common/bin/my/home' r='happy Home' sample.rpt
5,654
Posted By Ygor
The same code reformatted via gawk --profile...
The same code reformatted via gawk --profile gives... # gawk profile, created Wed Jul 25 09:58:45 2012

# BEGIN block(s)

BEGIN {
f1 = 0
i...
1,568
Posted By Ygor
Try...awk...
Try...awk '$1~/^RBE/{f=1}$1!~/^RBE/&&$1~/[A-Z]/{f=0}f' nastran1.bdf > rbe.data
3,627
Posted By Ygor
Try...paste -d '|' File1.txt File2.txt | awk -F...
Try...paste -d '|' File1.txt File2.txt | awk -F '|' '{c=NF/2;for(i=1;i<=c;i++)if($i!=$(i+c))printf "line %-5s field %s\n",NR,i}'
1,018
Posted By Ygor
You could probably take out the $1=$1 since the...
You could probably take out the $1=$1 since the input and output field separators are the same.
1,988
Posted By Ygor
Try...awk -F: '$3~/EMPLID/{split($3,a," ");printf...
Try...awk -F: '$3~/EMPLID/{split($3,a," ");printf "%s,",a[3]}$2~/^ ORA/{print $NF}' file1
3,240
Posted By Ygor
Try...$ cat file1 : select col1 , col2 from...
Try...$ cat file1
:
select col1 , col2 from /* selecting columns from the table1 */ table1;
:
/* etc1
etc2
*/
:
select col1 , col2
from /* selecting columns from the table1 */...
2,551
Posted By Ygor
Try...$ echo...
Try...$ echo 'oracle=user=name/pa/ssword@database' > sample.cfg

$ eval $(awk '/oracle/{
if(match($0,/=[^/]*/))
printf "user=\047%s\047\n", substr($0,RSTART+1,RLENGTH-1)
...
2,551
Posted By Ygor
Try...$ echo 'oracle=username/password@database'...
Try...$ echo 'oracle=username/password@database' > sample.cfg

$ set -- $(awk -F '[=/@]' '/oracle/{print $2,$3,$4}' sample.cfg)

$ echo user is $1, pass is $2, db is $3
user is username, pass is...
1,451
Posted By Ygor
Choose a temporary delimiter that does not exist...
Choose a temporary delimiter that does not exist within the file..paste -d '~' File[123] | awk -F '~' '{printf "%-39s%-20s%-20s\n",$1,$2,$3}'
989
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,184
Posted By Ygor
All in one...awk 'BEGIN { FS = "_" ...
All in one...awk 'BEGIN {
FS = "_"
fmt = "%sTime: %s Host: %s Instance: %s Dirs: "
}
{
if ($4 != prev) {
printf fmt, (dirs?dirs ORS:""), $4, $1,...
Showing results 1 to 25 of 98

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