How do i print this output all on the same line?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How do i print this output all on the same line?
# 1  
Old 02-05-2008
How do i print this output all on the same line?

I have this simple script which gives info on HBA ports. How do i get it all to print on the same line?

!#/bin/ksh

TMP_INFOFILE=/tmp/tmpfile
if [ -f $TMP_INFOFILE ]; then
rm -f $TMP_INFOFILE
touch $TMP_INFOFILE
fi

PORT_INFOFILE=/tmp/aa

if [ -f $PORT_INFOFILE ]; then
rm -f $PORT_INFOFILE
touch $PORT_INFOFILE
fi

# Creating port list for fcinfo specific query

fcinfo hba-port | grep HBA | awk '{print $4}' >> $PORT_INFOFILE 2>&1

# read port info
#setting up variables within the body of the for loop

for i in `cat $PORT_INFOFILE`

do
OSVER=`fcinfo hba-port $i | grep -i "OS Device" | cut -d':' -f2`
CONT=`fcinfo hba-port $i | grep -i "OS Device" | cut -d':' -f2 | cut -d'/' -f4`
MANU=`fcinfo hba-port $i | grep -i "Manufacturer" | cut -d':' -f2`
MOD=`fcinfo hba-port $i | grep -i "Model" | cut -d':' -f2`

echo "$CONT" >> $TMP_INFOFILE
DEV=`cfgadm -al $CONT | grep disk | awk '{printf $1"\n"}' | cut -d':' -f3` >> $TMP_INFOFILE

echo "$DEV" >> $TMP_INFOFILE
luxadm display $DEV | grep "DEVICE PROPERTIES" | cut -d':' -f2 >> $TMP_INFOFILE
echo "HBA-Port-WWN-------- $i" >> $TMP_INFOFILE
echo "OS Device----------$OSVER" >> $TMP_INFOFILE
echo "Manufacturer--------$MANU" >> $TMP_INFOFILE
echo "Model---------------$MOD" >> $TMP_INFOFILE


if [ $MOD == "375-3108-xx" ]; then
echo "############Crystal-2A############" >> $TMP_INFOFILE

elif [ $MOD == "375-32X3-01" ]; then
echo "############Prism############" >> $TMP_INFOFILE

elif [ $MOD == "LP11002-S" ]; then
echo "############Pyramid-E2############" >> $TMP_INFOFILE

elif [ $MOD == "LP10000DC-S" ]; then
echo "############Rainbow############" >> $TMP_INFOFILE

fi
done

cat $TMP_INFOFILE




c10
20030003ba13f368
20030003ba13f6cc
200800a0b8222f9a
200900a0b8222f9a
216000c0ff803622
226000c0ffa03622
256000c0ffc03622
266000c0ffe03622
/dev/rdsk/c0t60003BA13F368000461CE62900056C40d0s2
/dev/rdsk/c0t60003BA13F368000461CE5FC00074EDCd0s2
/dev/rdsk/c0t60003BA13F368000461CE61A000051B0d0s2
/dev/rdsk/c0t60003BA13F368000461CE5EC000CCC48d0s2
/dev/rdsk/c0t600A0B8000222F9900004B2345A6120Cd0s2
/dev/rdsk/c0t600A0B8000222F9900004B1F45A6114Ad0s2
/dev/rdsk/c0t600A0B8000222F9900004B1D45A61112d0s2
/dev/rdsk/c0t600A0B8000222F9900004B1A45A61094d0s2
/dev/rdsk/c0t600C0FF0000000000036221625DD7901d0s2
/dev/rdsk/c0t600C0FF0000000000036221625DD7900d0s2
/dev/rdsk/c0t600C0FF0000000000036220154E1B601d0s2
/dev/rdsk/c0t600C0FF0000000000036220154E1B600d0s2
HBA-Port-WWN-------- 10000000c9420b4b
OS Device---------- /dev/cfg/c10
Manufacturer-------- Emulex
Model--------------- LP10000DC-S
############Rainbow############
# 2  
Old 02-05-2008
cat $TMP_INFOFILE | xargs ( >newfile_if_you_wish)
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Read line and print output

need help to print the below .. Content of file looks like below .. SCHEMA1. TABLE1 SCHEMA2. TABLE2 SCHEMA3. TABLE3 read lines from above file and print o/p as below print output like read 1st line and print SELECT SCHEMA1.TABLE1 print output like read 2st line and print ... (4 Replies)
Discussion started by: rocking77
4 Replies

2. Shell Programming and Scripting

Print loop output on same line dynamically

Hi, I am trying to print copy percentage completion dynamically by using the script below, #!/bin/bash dest_size=0 orig_size=`du -sk $sourcefile | awk '{print $1}'` while ; do dest_size=`du -sk $destfile | awk '{print $1}'` coyp_percentage=`echo "scale=2; $dest_size*100/$orig_size"... (4 Replies)
Discussion started by: Sumanthsv
4 Replies

3. UNIX for Beginners Questions & Answers

Output to file print as single line, not separate line

example of problem: when I echo "$e" >> /home/cogiz/file.txt result prints to file as:AA BB CC I need it to save to file as this:AA BB CC I know it's probably something really simple but any help would be greatly appreciated. Thank You. Cogiz (7 Replies)
Discussion started by: cogiz
7 Replies

4. Shell Programming and Scripting

Print line number from piped output

i need to do something like this: script.sh #!/bin/sh echo "hello" echo "My First name is John" echo "My Last name is Smith" echo "I am here to save you a lot of work" sed -n 4,5p $0 i dont want to run the script. i just want to pull out specific line from it. so the logic here... (5 Replies)
Discussion started by: SkySmart
5 Replies

5. Linux

Print line 1 if line 3 matches of the output

Hi I want to extend following command so that on the basis of "Branch: ****" on the third line I can grep and print name of the file on the first line. cat .labellog.emd | grep DA2458A7962276A7E040E50A0DC06459 | cut -d " " -f2 | grep -v branch_name | xargs -I file <command to describe> file ... (1 Reply)
Discussion started by: ezee
1 Replies

6. Shell Programming and Scripting

Print awk output in same line ,For loop

My code is something like below. #/bin/bash for i in `ps -ef | grep pmon | grep -v bash | grep -v grep | grep -v perl | grep -v asm | grep -v MGMT|awk '{print $1" "$8}'` do echo $i ORACLE_SID=`echo $line | awk '{print $2}'` USERNAME=`echo $line | awk '{print $1}'` done ============= But... (3 Replies)
Discussion started by: tapia
3 Replies

7. Shell Programming and Scripting

Print output and read input on same line

How do I print output and read input on the same line in ksh? echo Hello, what is your name? read name (1 Reply)
Discussion started by: robin_simple
1 Replies

8. Shell Programming and Scripting

print out a line from a output file

I am trying to have a script ping all the clients then output it to a file so I know which clients are off then have the next script pull the ones that are online and reboot them. This is what I am running with right now. If there is something KISS then by all means please let me know. ... (3 Replies)
Discussion started by: deaconf19
3 Replies

9. Shell Programming and Scripting

How to print the output in single line

Hi, Please suggest, how to get the output of below script in single line, its giving me in different lines ______________________ #!/bin/ksh export Path="/abc/def/ghi"; Home="/home/psingh/prat"; cd $Path; find $Path -name "*.C#*" -newer "abc.C#1234" -print > $Home cat $Home | while... (1 Reply)
Discussion started by: Prat007
1 Replies

10. UNIX for Dummies Questions & Answers

locating the line and print the output

hi all, I would like to know , if a file contains say 100 lines, and if i want to locate the 54th line and print the output , how to do it?? for eg , if a file details.txt which contains say 100 entries like admin .................... rajes .................... test ..................... (7 Replies)
Discussion started by: vasikaran
7 Replies
Login or Register to Ask a Question