Search Results

Search: Posts Made By: sam_bd
2,144
Posted By MadeInGermany
The output is redirected to $OUTPUTLIST i.e. the...
The output is redirected to $OUTPUTLIST i.e. the file output.txt
cat output.txt
2,144
Posted By vbe
while read host do ssh -n $host...
while read host
do
ssh -n $host "hostname;echo $HOME"

You should NEVER name a variable the same as a reserved word : host ( usually system variable, or like here a true UNIX command...)
2,144
Posted By MadeInGermany
That goes into the next trap: ssh reads from...
That goes into the next trap: ssh reads from stdin i.e. the while loop's input.
A fix is -n.
Further, it makes more sense to print the remote $HOME; within 'ticks' the local shell does not...
2,144
Posted By RudiC
There are quite some errors and opportunitites in...
There are quite some errors and opportunitites in your code:
- the $(host) is a "command substitution", not a variable expansion. Use braces instead (as you do for the list files).
- the ´hostname´...
1,647
Posted By RavinderSingh13
Hello sam_bd, Could you please go through...
Hello sam_bd,

Could you please go through the following explanation and let me know if this helps you.

awk -F"=" ' ###Set field seprator as "=" here.
/SName/{ ...
1,647
Posted By RavinderSingh13
Hello sam_bd, As your sample Input_file is...
Hello sam_bd,

As your sample Input_file is NOT clear, still on few assumption on question. Could you please try following and let me know if this helps you.

awk -F"=" '/SName/{VAL=$0;next}...
2,645
Posted By RavinderSingh13
Hello sam_bd, Could you please try...
Hello sam_bd,

Could you please try following and let me know if this helps you(Not tested though).

ps -eaf | grep ApplnName | awk '/\/opt\/xxx\/yyy/'


Thanks,
R. Singh
2,645
Posted By MadeInGermany
Or ps -eaf | grep '[A]pplnName' | awk...
Or
ps -eaf | grep '[A]pplnName' | awk '$0~"/opt/xxx/yyy"'Or a pure string search (no ERE)
ps -eaf | grep '[A]pplnName' | awk 'index($0,"/opt/xxx/yyy")'{print} is the default action in awk.
The [ ]...
2,645
Posted By RudiC
Gents, why the grep? ps -eaf | awk...
Gents, why the grep?

ps -eaf | awk '/[Aa]pplname/ && /\/opt\/xxx\/yyy/'
3,791
Posted By Don Cragun
If you copied rbatte1's script verbatim, your...
If you copied rbatte1's script verbatim, your input file must be in DOS format with <carriage-return><newline> line terminators instead of UNIX format <newline> line terminators. To verify, show us...
3,791
Posted By clx
You are not appending (>>) the file but...
You are not appending (>>) the file but overwriting (>) it every time. Possibly your input file contains blank line as last line or the last line contains spaces thats why its causing the variable of...
1,841
Posted By SriniShoo
echo "enter SID" read SID echo "enter...
echo "enter SID"
read SID
echo "enter filename"
read filename
awk -F ";" -v sid="${SID}" '$0 ~ sid { print $2 }' "${filename}"
exit 0
1,841
Posted By Roozo
Small change on awk. #!/bin/ksh ...
Small change on awk.


#!/bin/ksh

echo "enter SID"
read SID
echo "enter filename"
read filename
awk -F";" '/'"$SID"'/ { print $2 }' ${filename}
exit 0



try...
1,841
Posted By Akshay Hegde
Try : $ awk -F';' 'BEGIN{ printf "Enter SID :...
Try :
$ awk -F';' 'BEGIN{ printf "Enter SID : "; getline sid < "-"; printf "Enter Filename : "; getline file < "-"; while(getline < file){ if($0 ~ sid ) print $2 }close(file) }'

---------- Post...
1,841
Posted By SriniShoo
echo "enter SID" read SID echo "enter...
echo "enter SID"
read SID
echo "enter filename"
read filename
awk -F ";" -v sid="${SID}" '/sid/ { print $2 }' "${filename}"
exit 0
1,792
Posted By shamrock
you can just do this to store the last column in...
you can just do this to store the last column in a shell variable...
VAR=$(awk '{print $NF}' file)
where file contents are...

sam2 PS 03/10/11 0 441
3,507
Posted By vbe
My last attempt: ant:/home/vbe $ uname -a ...
My last attempt:

ant:/home/vbe $ uname -a
HP-UX ant B.11.11 U 9000/800 168921511 unlimited-user license
ant:/home/vbe $
ant:/home/vbe $ vi 003
#!/usr/bin/ksh

CONT=1
while [ CONT -gt 0 ]...
1,373
Posted By linuxn00b
make your code look like the following and it...
make your code look like the following and it will work for you. You need to put "" around the the second "$a"_bkp. You might also want to do a cp -p to preserve ownership, permissions, etc.
...
1,089
Posted By ahamed101
Try this awk...
Try this


awk '{split($5,arr,"_");sub(";","_"arr[2]";",$4);print}' file
Showing results 1 to 19 of 19

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