Sponsored Content
Top Forums Shell Programming and Scripting Help needed to stick on variable data to an output Post 302346389 by asirohi on Friday 21st of August 2009 06:05:10 PM
Old 08-21-2009
Help needed to stick on variable data to an output

Hi all,

I need help now to stick the value inside $RHAT_PRODUCT and display that in every line in the output. What changes in the code can i do.

Please suggest

Thanks
Adsi

Code:
#!/bin/sh

ECHO=/bin/echo
FIND=/bin/find
AWK=/bin/awk
LS=/bin/ls
GREP=/bin/grep

ROOT_PATH=/net/icebox/vol/local_images/spins
STREAM_PATH=$ROOT_PATH/7.1
RHAT_PLATFORM=`$FIND $STREAM_PATH . -depth -name ShareableEntities | $AWK -F"/" '{if($10 ~ /rhat_x86/) print $0}'`
RHAT_PRODUCT=`$FIND $STREAM_PATH . -depth -name ShareableEntities | $AWK -F"/" '{if($10 ~ /rhat_x86/) print $8}'`

$ECHO "The Products are: " $RHAT_PRODUCT

usage() {
 $ECHO "Usage:  rhat"
}

check_rhat(){
for i in $RHAT_PLATFORM
do
$ECHO "The path is:" $i
$LS $i | $GREP .su | $AWK -F"_" '{print $1}'
done 
}

if [ $# -eq 0 ]; then
  usage
  exit 0
fi

PLATFORM_LIST="$*"
if [ "$1" = "sun" ]; then
  check_rhat
fi
exit 0

Original Output:-
Code:
The Products are: MS DS
 The Path is: /net/icebox/vol/local_images/spins/7.1/MS/7.1.D081110/rhat_x86/ShareableEntities
atria.basement.linux
atria.msgcat.JPN.linux
atria.perl.linux
CMServer.CQ.linux
com.ccl.feedreader.feature
The Path is: /net/icebox/vol/local_images/spins/7.1/DS/7.1.D081110/rhat_x86/ShareableEntities
MS.shipping.server.linux
org.eclipse.gef.feature
org.eclipse.jdt.feature
org.eclipse.platform.feature
org.eclipse.rcp.feature
ratl.WAS.linux


Output Desired:-

Code:
The Products are: MS DS
 The Path is: /net/icebox/vol/local_images/spins/7.1/MS/7.1.D081110/rhat_x86/ShareableEntities
MS DS atria.basement.linux
MS DS atria.msgcat.JPN.linux
MS DS atria.perl.linux
MS DS CMServer.CQ.linux
MS DS com.ccl.feedreader.feature
MS DS com.ccl.welcome.bits.feature
The Path is: /net/icebox/vol/local_images/spins/7.1/DS/7.1.D081110/rhat_x86/ShareableEntities
MS DS MS.shipping.server.linux
MS DS org.eclipse.gef.feature
MS DS org.eclipse.jdt.feature
MS DS org.eclipse.platform.feature
MS DS org.eclipse.rcp.feature
MS DS org.eclipse.test.feature
MS DS ratl.WAS.linux

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to assign sql output data to shell script variable

Hi Guys ! I am new to unix and want to find out how we can make sql statement data to shell script variable? Any help/suggestion is greatly appreciated -Chandra (1 Reply)
Discussion started by: kattics
1 Replies

2. UNIX for Advanced & Expert Users

how to read the data from an excel sheet and use those data as variable in the unix c

I have 3 columns in an excel sheet. c1 c2 c3 EIP_ACCOUNT SMALL_TS_01 select A.* from acc; All the above 3 col shoud be passed a variable in the unix code. 1.How to read an excel file 2.How to pass these data as variable to the unic script (1 Reply)
Discussion started by: Anne Grace
1 Replies

3. Shell Programming and Scripting

Help Needed in arrangind data!

Dear All, Please view the below mentioned text and help me in arranging data in format like DATE TIME Value (2nd-Feild) e.g. 20-JUN-209 00:25:38 69.00 ........... ........... ........... ........... and so on till the file end. 20-JUN-2009 00:25:38, 195.20, ... (10 Replies)
Discussion started by: jojo123
10 Replies

4. Shell Programming and Scripting

Help needed to sort data

Hello All, Today i have been asking lots of question, hope to become good in scripting soon with all the wonderful advices i get. The question is i want to sort data a get uniq string from it. The code i am using to generate the output is:- check_sun() { for i in $SUN_PLATFORM do $ECHO... (0 Replies)
Discussion started by: asirohi
0 Replies

5. UNIX for Dummies Questions & Answers

Help Needed with Sorting Output

Hi all, I'm using Solaris 10, and need help in sorting the below output from the syslog file in descending rather than ascending order. I would like both the hostname and message columns to be sorted, but right now only the message is sorted and the count column, whose order I would like... (2 Replies)
Discussion started by: wthomas
2 Replies

6. Shell Programming and Scripting

Converting variable space width data into CSV data in bash

Hi All, I was wondering how I can convert each line in an input file where fields are separated by variable width spaces into a CSV file. Below is the scenario what I am looking for. My Input data in inputfile.txt 19 15657 15685 Sr2dReader 107.88 105.51... (4 Replies)
Discussion started by: vharsha
4 Replies

7. Shell Programming and Scripting

Parsing XML (and insert data) then output data (bash / Solaris)

Hi folks I have a script I wrote that basically parses a bunch of config and xml files works out were to add in the new content then spits out the data into a new file. It all works - apart from the xml and config file format in the new file with XML files the original XML (that ends up in... (2 Replies)
Discussion started by: dfinch
2 Replies

8. Shell Programming and Scripting

Help!! needed to get the desired output

Am in need of your help to get the desired output. nameSECURITY.SERVICES.CONFIG:GETVALUEisPrefetchedNsAccessLast2013-09-13 10:50:13 MESTsAccessTotal1sRunningcHitLastnamePUBLIC.SERVER:INVOKEisPrefetchedNsAccessLast2013-09-17 15:02:05... (5 Replies)
Discussion started by: rocky2013
5 Replies

9. Shell Programming and Scripting

Help needed in formatting the output

Hi All, Need your help in resolving the below issue. I've a file called "data.txt" with the below lines: TT: <tell://me/sreenivas> <tell://me/100> <tell://me/500> TT: <tell://me/sudheer> <tell://me/300> TT: <tell://me/sreenivas> <tell://me/200> TT:... (6 Replies)
Discussion started by: raosr020
6 Replies

10. UNIX for Advanced & Expert Users

Passing variable as input & storing output in other variable

I have a below syntax its working fine... var12=$(ps -ef | grep apache | awk '{print $2,$4}') Im getting expected output as below: printf "%b\n" "${VAR12}" dell 123 dell 456 dell 457 Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
Discussion started by: sam@sam
5 Replies
COLORGCCRC(5)							File Formats Manual						     COLORGCCRC(5)

NAME
colorgccrc - configuration file for colorgcc DESCRIPTION
A colorgccrc configuration file is used to configure the highlighting of the compiler output from colorgcc. SYNTAX
Each line consists of a keyword designating a configuration variable. The keyword is followed by `:' and then one or several values (depending on the keyword). Lines beginning with a hash mark `#' are comments. CONFIGURATION VARIABLES
g++ | gcc | c++ | cc | g77 | gcj | gnat | gpc Specifies the paths to the compilers. Takes one value; a path to the compiler. nocolor Specifies what terminal types colorization should be disabled on. Takes one or several values, separated by whitespace. srcColor Specifies the highlighting attributes source-code should be given. Takes one or several color attributes. See the section COLOR ATTRIBUTES for more information. introColor Specifies the highlighting attributes for normal compiler output. Takes one or several color attributes. See the section COLOR ATTRIBUTES for more information. warningFileNameColor | errorFileNameColor Specifies the highlighting attributes for the filename in a warning or an error, respectively. Takes one or several color attributes. See the section COLOR ATTRIBUTES for more information. warningNumberColor | errorNumberColor Specifies the highlighting attributes for the line-number in a warning or an error, respectively. Takes one or several color attributes. See the section COLOR ATTRIBUTES for more information. warningMessageColor | errorMessageColor Specifies the highlighting attributes for the message-text in a warning or an error, respectively. Takes one or several color attributes. See the section COLOR ATTRIBUTES for more information. COLOR ATTRIBUTES
The following attributes are valid for highlighting. clear, reset bold, underline, underscore, blink, reverse, concealed black, red, green, yellow, blue, magenta, cyan, white on_black, on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white SEE ALSO
gcc(1), colorgcc(1) HISTORY
Jan 15 2003: Initial version of this manual-page. REPORTING BUGS
Report bugs to <jmoyers@geeks.com> AUTHORS
Jamie Moyers <jmoyers@geeks.com> is the author of colorgcc. This manual page was written by Joe Wreschnig <piman@sacredchao.net>, and modified by David Weinehall <tao@debian.org>, for the Debian GNU/Linux system (but may be used by others). COPYRIGHT
Copyright (C) 2003 Jamie Moyers This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. Jan 15, 2003 COLORGCCRC(5)
All times are GMT -4. The time now is 08:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy