I would like to assign command (with pipe) output to a variable. The code is as follows. The goal of the code is to get the last folder folder with a particular name pattern.
Hi,
I am giving a grep command, and i am getting the output. i want to store it in a variable
for eg
a = grep '12345' /dir/1/2/log.txt ( the output is number)
b= grep 'basic' /dir/1/2/log1.txt (in this case the output is character)
so how to assign the output of grep to a variable
... (1 Reply)
Hi,
I work in ksh88.
I have an interective script which prompts the user for the input and returns numeric value depending on the input provided. I need to call this script inside another script and then assign the resulting output the the variable.
The call like that A=`my script` obviously... (6 Replies)
greetings all,
I am have a heck of a time trying to accomplish a very simple thing. I have an array of "shortname<spaces>id" created from a dscl output. I want to assign shortname=word1 and id=word2. I have tried
shortname=$(${textArray} | awk '{print $1}') - and get 'awk : cannot open... (3 Replies)
Greetings folks,
I am trying to assign the output of a dscl command (contains name<spaces>id) to a variable as an array. Currently I am piping the output into a tmp file, then reading the tmp file into an array, then parsing the array. I would like to bypass creating the tmp file portion of... (6 Replies)
Hi, wondering if it's been asked before but didn't find matches from google. Basically I have this line:
myvar=$(echo -e "a\tb")
Now somehow the '\t' from the echo output gets replaced with white space and then stored in $myvar.
It creates a problem for me later to use tab as delimiter to do... (2 Replies)
Code
set -x
STATUS="0"
echo $STATUS
for i in `ls -ltr Report*|awk '{ print $9 }'`
do
if
then
flg = "`head -1 "$i" |cut -c 31-33`"
echo `head -1 "$i" |cut -c 31-33`
echo $flg
if
then
echo "having Fun"
STATUS="2"
else
echo "no Fun"
fi
fi (2 Replies)
Hi Folks,
I am trying to assign a value from the command to a dynamic variable. But I am not getting the desired output.. I am sure something is wrong so i need experts advise.
There will be multiple files like /var/tmp/server_1, /var/tmp/server_2, /var/tmp/server_3, having different server... (6 Replies)
Hi
iam new to shell scripting
how to declare variables as redshift query and I have to compare two counts by using if condition .
ex:count=select count(*) from prd;
select count(*) from prd;
select count(*) from tag;
can any one help me .
Please use CODE tags when displaying... (1 Reply)
In the else of the main if condition .
else
set lnk = $(readlink -f <path> | cut -d '/' -f7)
echo "$lnk"
if ]
When I run the above on command line , the execution seems to be fine and I get the desired output. But when I try to assign it to a variable within a loop... (12 Replies)
Discussion started by: sankasu
12 Replies
LEARN ABOUT ULTRIX
packf
packf(1mh)packf(1mh)Name
packf - compress a folder into a single file
Syntax
packf [ +folder ] [ msgs ] [ -file name ] [ -help ]
Description
Each message in a folder is normally stored as a separate file. The command takes all messages from the current folder and copies them to
a single specified file. Each message in the file is separated by four <CTRL/A>s and a newline.
You can specify a folder other than the current folder by using the +folder argument. If you do not want all the messages in a folder to
be packed into one file, you can specify a number of messages or a range of messages with message numbers.
The first message packed will become the current message. If you specify a +folder argument, that folder will become the current folder.
When messages have been packed into a file using you can separate them into individual messages using the command. See
Options-file name
Specifies the file in which you want the message(s) to be stored. If you specify an existing file then the specified messages
will be appended to the end of that file. Otherwise, a new file will be created and the messages placed in it. If you do not
specify a filename, attempts to place the messages in a file called in the current working directory. If this file does not
exist, asks whether you want to create it.
-help Prints a list of the valid options to this command.
The default settings for this command are:
+folder defaults to the current folder
msgs defaults to all
-file ./msgbox
Examples
The first example shows all the messages in the folder being packed into a file called
% packf +lrp -file planning
The next example shows how prompts you if you do not specify a -file option. A file called is created by in your home directory, and mes-
sages 3 to 5 are packed into it:
% packf +lrp 3-5
Create file "/machine/disk/username/msgbox"? y
Profile Components
Path: To determine the user's Mail directory
Msg-Protect: To set protections when creating a new file
Files
$HOME/.mh_profile The user profile.
See Alsoburst(1mh)packf(1mh)