Help needed to stick on variable data to an output

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help needed to stick on variable data to an output
# 1  
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




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"

$ECHO "The path is:" $i
$LS $i | $GREP .su | $AWK -F"_" '{print $1}'

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

if [ "$1" = "sun" ]; then
exit 0

Original Output:-
The Products are: MS DS
 The Path is: /net/icebox/vol/local_images/spins/7.1/MS/7.1.D081110/rhat_x86/ShareableEntities
The Path is: /net/icebox/vol/local_images/spins/7.1/DS/7.1.D081110/rhat_x86/ShareableEntities

Output Desired:-

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

# 2  
Old 08-21-2009
Not sure, but try this:

$LS $i | $GREP .su | sed "s/^/$RHAT_PRODUCT\_/" | $AWK -F"_" '{print $1,$2}'

Disclaimer: Untested code.

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question