Search Results

Search: Posts Made By: ksheller
1,826
Posted By ksheller
Thanks a lot!
Thanks a lot!
2,521
Posted By ksheller
It depends how you are using SSH in your script....
It depends how you are using SSH in your script. You could filter out the banner using a regex, or maybe try the Expect module.
1,826
Posted By ksheller
perl: Please explain this for me: $hexdigit = (0 .. 9, 'a' .. 'f')[$num & 15];
This is taken from perlop. I can't understand what's going on, please can someone explain this for me?


$hexdigit = (0 .. 9, 'a' .. 'f')[$num & 15];

to get a hexadecimal digit
4,311
Posted By ksheller
Franklin52, that doesn't give me the if/else...
Franklin52, that doesn't give me the if/else functionality. I need it to either print the first field, or if there are no fields, print a newline. Also, I am manipulating the input from grep.
...
4,311
Posted By ksheller
That makes sense. So awk chokes when it receives...
That makes sense. So awk chokes when it receives an empty string. That is a huge drawback. Thanks for letting me know.

BTW, I was trying to replace the following code with a one-liner:
...
4,311
Posted By ksheller
Awk: Can anyone tell me why this doesn't work?
If there exists a field in stdin, print it, otherwise, print hello.....

These print nothing:

cat /dev/null | awk '{if ( length > 0 ) print $1; else print "hello"}'

cat /dev/null | awk '{if...
7,533
Posted By ksheller
Hi radoulov Your code works perfectly. You...
Hi radoulov

Your code works perfectly. You have taught me something new and I am extremely grateful.

Regards
7,533
Posted By ksheller
Thanks for your fast response. Unfortunately...
Thanks for your fast response.

Unfortunately read only reads the first line, even if I set IFS like you did.

This is what happens:

nptcmc01,sys,root # (
> IFS='
> '
> read a b c d < file...
7,533
Posted By ksheller
ksh: How to store each output line into a different variable?
Example output:

/tmp/generatelines.sh
line1
line2
line3
line4

I want each output line assigned to its own variable, ie:

"line1" --> $a
"line2" --> $b
"line3" --> $c
"line4" --> $d
...
Showing results 1 to 9 of 9

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