Sponsored Content
Top Forums Shell Programming and Scripting Set specific part in command output into variable Post 302225228 by orit on Friday 15th of August 2008 12:39:15 AM
Old 08-15-2008
Set specific part in command output into variable

I am trying unsuccessfully to set into a variable a specific part of command output:
The command output will be as:
line 1: <varied>
line 2: 2 options:
option 1:
Set view: ** NONE **
or
option 2:
Set view: <different_name_of_views_always_without_spaces>

and I would like to get into the variable either the ** NONE ** or the name of the view (<different_name_of_views_always_without_spaces> in option 2).

What is the syntax to find that "field" into my variable?

Thanks a lot
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Export command giving Variable Name vs the Value set for the Variable

I'm having an issue when I export within my program. I'm getting the variable name, not the variable value. I have a configuration file (config.txt) that has the values of the variables set as so: set -a export ARCHIVEPOSourceDir="/interfaces/po/log /interfaces/po/data" export... (2 Replies)
Discussion started by: ParNone
2 Replies

2. UNIX for Dummies Questions & Answers

Set a variable from awk output

I have a file which I am processing using awk to spit out the following: export CLIENT=1 ; export USER=1 ; export METABASE=1 ; export TASK=1 ; export TOTAL=3 What i want to do now is execute that within the script so those variables are available to other commands. I've tried piping the... (3 Replies)
Discussion started by: Cranie
3 Replies

3. Shell Programming and Scripting

How to set IFS for a specific command

Hi there, I'm using two commands that need different IFS. The mysql command need IFS to include space because I'm given the mysql command as a variable: supernova:~# cat myscript IFS=' ' MYSQL="mysql -u user -ppassword database" $MYSQL -Ne "SELECT COUNT(1), MAX(id), MAX(name) FROM terminal"... (7 Replies)
Discussion started by: chebarbudo
7 Replies

4. Shell Programming and Scripting

set variable to command output

I'm hoping you guys can help me out here. I've been trying different methods to try and get what IW as hoping would be a fairly simple script but has turned into a pain. Bit of background - I am writing a script to check values in certain failes to ensure they are corerct. I'm runnign this on... (2 Replies)
Discussion started by: stuc
2 Replies

5. Shell Programming and Scripting

BASH - set specific user variable via string operators

Apologies for the utter triviality of this question, but we all have to start somewhere! I've also tried searching but this question is pretty vague so I didn't (a) really know what to search for or (b) get many relevant hits to what I did search for. Anyway, I'm in the process of self-teaching... (1 Reply)
Discussion started by: u5j84
1 Replies

6. HP-UX

What is the use of command set -- and set - variable?

Hi, I am using hp unix i want to know the use of the following commands set -- set - variable thanks (4 Replies)
Discussion started by: gomathi
4 Replies

7. Shell Programming and Scripting

set output of linux cmd as a variable in .exp

I am trying to make a script to take commands from a .txt file ( line by line) and pass it using send ( used in another function ) what i am trying to achieve is : set nol "`grep '' ${exp_path2}/cmdlist.txt | wc -l `" as in shell script nol=`grep '' $exp_path2/cmdlist.txt | wc -l` ... (0 Replies)
Discussion started by: dixyantar
0 Replies

8. Shell Programming and Scripting

Parse output path to set variable

I am looking to parse a text file output and set variables based on what is cropped from the parsing. Below is my script I am looking to add this feature too. All it does is scan a certain area of users directories for anyone using up more than X amount of disk space. It then writes to the... (4 Replies)
Discussion started by: es760
4 Replies

9. UNIX for Dummies Questions & Answers

Set Command to output a log of every command executed in the script

Hi Guys, I like to output every command executed in the script to a file. I have tried set -x which does the same. But it is not giving the logs of the child script which is being called from my script. Is there any parameters in the Set command or someother way where i can see the log... (2 Replies)
Discussion started by: mac4rfree
2 Replies

10. Shell Programming and Scripting

Save an specific part of a expect_out in a variable

I have a expect file like this #!/opt/tools/unsupported/expect-5.39/bin/expect spawn ssh -l user ip expect_after eof {exit 0} set timeout 10 log_file /report.txt expect "Password:" { send "pasword\r" } expect "$ " { send "date\r" } expect "$ " { send "readlink /somelink\r" } set... (7 Replies)
Discussion started by: bebehnaz
7 Replies
XZLESS(1)							     XZ Utils								 XZLESS(1)

NAME
xzless, lzless - view xz or lzma compressed (text) files SYNOPSIS
xzless [file...] lzless [file...] DESCRIPTION
xzless is a filter that displays text from compressed files to a terminal. It works on files compressed with xz(1) or lzma(1). If no files are given, xzless reads from standard input. xzless uses less(1) to present its output. Unlike xzmore, its choice of pager cannot be altered by setting an environment variable. Com- mands are based on both more(1) and vi(1) and allow back and forth movement and searching. See the less(1) manual for more information. The command named lzless is provided for backward compatibility with LZMA Utils. ENVIRONMENT
LESSMETACHARS A list of characters special to the shell. Set by xzless unless it is already set in the environment. LESSOPEN Set to a command line to invoke the xz(1) decompressor for preprocessing the input files to less(1). SEE ALSO
less(1), xz(1), xzmore(1), zless(1) Tukaani 2010-09-27 XZLESS(1)
All times are GMT -4. The time now is 04:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy