I am looping finger command and trying to get each line content into a variable. Output of finger command produces more than one line and each line was multiple words.
The issue is entire line is not coming into $get_line, i am getting each word from a single line into a different line.
Please help me how to get entire line content into variable.
Thanks in advance.
Venkat
Last edited by Franklin52; 01-11-2012 at 03:24 AM..
Reason: Please use code tags for code and data samples, thank you
Another newbie to Unix scripting Q..
How do you assign a value resulting from a command, such as awk, to a variable.
I am currently trying:-
$awk '{print $1}' file1 > variable1
with no change to $variable1.
The line:
$awk '{print $1}' file1
does print the first line of the... (3 Replies)
Hi
In my shell script, I'm trying to find the line count of a file and assign it to a variable.
LINE_COUNT=$(wc -l $FILE_NAME)
But when i display LINE_COUNT, i'm getting the linecount concatenated with the file name. I want only the number. How can i get the line count alone ? Someone... (2 Replies)
hi all,
in ksh, how do i assign the output of a find command to a variable, e.g
am trying something like this :
totalNoFiles=$(print find ./ -name "SystemOut*.log");
but when i echo $totalNoFiles it displays
find ./ -name "SystemOut*.log"
instead of the total number of... (2 Replies)
can we make a global variable and store character values and add other values to that variable ?? for example
a="hello, John"
and can we add value ". How are you? so
a can have
"hello, John. How are you?"
can someone help me?? (2 Replies)
Hi folks.
I have this variable called FirstIN that contains something like this: 001,002,003,004...
I am trying to assign the content of this variable into ModifiedIN but with the following format : 001 002 003 004...(changing the commas for spaces)
I thought about using sed but i am not... (17 Replies)
my script is some thing like this
i11="{1,2,3,4,5,6,7,8,9,10,11,}"
echo "enter value"
read value ..............suppose i11
x="$value"
echo "$($value)" .............the echo should be {1,2,3,4,5,6,7,8,9,10,11,}
but its showing "i11" only.
plz help me out to get desired... (10 Replies)
Hi
I have a script that accepts an input date in YYYY-MM-DD format.
After that, I used sed to delete the hyphen (-) which gives me an output YYYY MM DD.
My question is, how can I assign those three numbers to a three different variable.
Example:
2013-11-23 will become 2013 11 23... (4 Replies)
Unable to get the value to a variable.
set -x
cd $HOME
echo "Enter the server name"
read a
echo $a
i=4
j=1
k = ps -ef | awk '/server1/{ print $4 }' | tail -$i | head -$j`
echo $k
When I do the same in command line it works, however the same does not work when I provide that in the... (1 Reply)
I have a date column as 06302015 but I need to have variable which extracts 063015.
Am trying something like below but it is not assigning
Please let me know if am missing something. Thanks in advance.
################################
#!/usr/bin/ksh
DT=06302015
... (7 Replies)
Discussion started by: weknowd
7 Replies
LEARN ABOUT DEBIAN
net::finger
Finger(3pm) User Contributed Perl Documentation Finger(3pm)NAME
Net::Finger - a Perl implementation of a finger client.
SYNOPSIS
use Net::Finger;
# You can put the response in a scalar...
$response = finger('corbeau@execpc.com');
unless ($response) {
warn "Finger problem: $Net::Finger::error";
}
# ...or an array.
@lines = finger('corbeau@execpc.com', 1);
DESCRIPTION
Net::Finger is a simple, straightforward implementation of a finger client in Perl -- so simple, in fact, that writing this documentation
is almost unnecessary.
This module has one automatically exported function, appropriately entitled "finger()". It takes two arguments:
o A username or email address to finger. (Yes, it does support the vaguely deprecated "user@host@host" syntax.) If you need to use a port
other than the default finger port(79), you can specify it like so: "username@hostname:port".
o (Optional) A boolean value for verbosity. True == verbose output. If you don't give it a value, it defaults to false. Actually, whether
this output will differ from the non-verbose version at all is up to the finger server.
"finger()" is context-sensitive. If it's used in a scalar context, it will return the server's response in one large string. If it's used
in an array context, it will return the response as a list, line by line. If an error of some sort occurs, it returns undef and puts a
string describing the error into the package global variable $Net::Finger::error. If you'd like to see some excessively verbose output
describing every step "finger()" takes while talking to the other server, put a true value in the variable $Net::Finger::debug.
Here's a sample program that implements a very tiny, stripped-down finger(1):
#!/usr/bin/perl -w
use Net::Finger;
use Getopt::Std;
use vars qw($opt_l);
getopts('l');
$x = finger($ARGV[0], $opt_l);
if ($x) {
print $x;
} else {
warn "$0: error: $Net::Finger::error
";
}
BUGS
o Doesn't yet do non-blocking requests. (FITNR. Really.)
o Doesn't do local requests unless there's a finger server running on localhost.
o Contrary to the name's implications, this module involves no teledildonics.
AUTHOR
Dennis Taylor, <corbeau@execpc.com>
SEE ALSO perl(1), finger(1), RFC 1288.
perl v5.8.8 2001-11-02 Finger(3pm)