Redirecting the output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Redirecting the output
# 1  
Old 04-04-2014
Redirecting the output

For example,
if we run the below command,
Code:
symcfg list -thin -pool

, results in an output most of the times and if the out is generated i'm able to redirect the output to a file. but sometimes it doesnt result any output and even though the output is being redirected, i can see "No Thin Pools " on the screen.
script below is what i used

Code:
sudo symcfg list | grep -E 'Local|Remote' | awk '{print $1}' | while read line; do line="${line##*()}";

sudo symcfg -sid "$line" list -thin -pool -GB > /tmp/pooltmp/file_"$line".dat

exists=$(grep -c 'No|error' /tmp/pooltmp/file_"$line".dat)
if [[ $exists -gt 0 ]]
 then
 #echo "No Device Pools"
 echo ""$line"" >> /tmp/pooltmp/nodevicepools.dat
 else
 #echo "Device Pools are configured"
 echo ""$line"" >> /tmp/pooltmp/devicepools.dat
 fi

 done >> /tmp/pooltmp/output

 cat /tmp/pooltmp/devicepools.dat | while read line ; do line="${line##*()}";
 output=`awk 'END{print NR}' /tmp/pooltmp/file_"$line".dat`
 if [[ "$output" -le 2 ]]
 then
 echo ""$line"" >> /tmp/pooltmp/nopoolarrays.dat
 else
 echo ""$line"" >> /tmp/pooltmp/symmetrixid.dat
 fi
 done

 if [[ -f /tmp/pooltmp/symmetrixid.dat ]]
 then
 echo "Refer /tmp/pooltmp/symmetrixid.dat for the Local and Remote VMAX arrays with thin pools"
 else
        echo "No output file generated"
 fi

 if [[ -f /tmp/pooltmp/nopoolarrays.dat ]]
 then
 echo "Refer /tmp/pooltmp/nopoolarrays.dat for the Local and Remote VMAX arrays with no thin pools"
 else
        echo "No Output file generated"
 fi


Last edited by Scrutinizer; 04-04-2014 at 09:54 PM.. Reason: code tags
# 2  
Old 04-04-2014
Does the message say "no thin pools" or does it say the full string you're echoing. In other words, could that message be from the symcfg command and it is writing to standard error.
# 3  
Old 04-04-2014
Code:
symcfg -sid 403 list -thin -pool -gb

>>>>>>>>>. this kind of output goes to a file

Code:
Symmetrix ID: 000008657403

                       S Y M M E T R I X   P O O L S                       
---------------------------------------------------------------------------
Pool         Flags  Dev              Usable       Free       Used Full Comp
Name         PTECSL Config              GBs        GBs        GBs  (%)  (%)
------------ ------ ------------ ---------- ---------- ---------- ---- ----
EFD12          TEFDEI RAID-5(3+1)      4399.1     1231.7     3167.4   72    0
FC---45        TFFDEI RAID-5(3+1)     33666.8    14650.7    19016.2   56    0
SATA---66      TSFDEI RAID-6(6+2)     51702.5    29381.0    22321.6   43    0

Total                            ---------- ---------- ---------- ---- ----
GBs                                 89768.4    45263.4    44505.2   49    0

Legend:
  (P)ool Type:
    S = Snap,  R = Rdfa DSE  T = Thin
  (T)echnology:
    S = SATA, F = Fibre Channel, E = Enterprise Flash Drive, M = Mixed, - = N/A
  Dev (E)mulation:
    F = FBA, A = AS400, 8 = CKD3380, 9 = CKD3390, - = N/A
  (C)ompression:
    E = Enabled, D = Disabled, N = Enabling, S = Disabling, - = N/A
  (S)tate:
    E = Enabled, D = Disabled, B = Balancing
  Disk (L)ocation:
    I = Internal, X = External, M = Mixed, - = N/A


Code:
symcfg -sid 675 list -thin -pool -gb

>>> for this it creates a file with the output but has only Symmetrix ID: 000192600675 in it. the rest is displayed on the screen

Code:
Symmetrix ID: 000192600675

The gatekeeper device (while using the Base Daemon) has an error (Please see the Log file)

or

Code:
symcfg -sid 459 list -thin -pool -gb

>>> for this it creates a file with the output but has only Symmetrix ID: 000192600675 in it. the rest is displayed on the screen

Code:
Symmetrix ID: 000192600459

No Device Pools found


Last edited by Scrutinizer; 04-04-2014 at 09:58 PM.. Reason: code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Redirecting output using if with awk

I have this line were I am selecting some fields from one file and creating a new file for the selected data. awk -F "\"*,\"*" '{print $1"," $2}' folderone/list.txt > folderone/qlist.txt This works, but then from this new file I want it to create a new file where it separates data: $2 >5 it... (2 Replies)
Discussion started by: rluna
2 Replies

2. Shell Programming and Scripting

Redirecting output to file

Hi, I have created script which redirect the output to file.I am able to get the output in file but not in the format. Output :Content of the log which have 10 -15 lines. Actal :Line1 ..Line 2Line3 Line4 Line 5 Expected:Line1 Line 2 Line3 Please... (7 Replies)
Discussion started by: karthik771
7 Replies

3. Shell Programming and Scripting

redirecting output using if-then-else in awk

I am trying to filter records based on number of "|", delimiter in my application. If number of "|" is greater than 14 its a bad record, else its a good record. I have to redirect output to two different files based on the if-then-else evaluation in AWK. if number of “|” in file_0 > 14 ... (2 Replies)
Discussion started by: siteregsam
2 Replies

4. UNIX for Dummies Questions & Answers

redirecting script output

Hello, I am interested in taking the output from a script i wrote and using it as input to a different script i wrote. So for example i want to take the output from program2 and use it as a parameter for program1. I didnt think i could use the >> symbols because i think that is just for .txt... (4 Replies)
Discussion started by: GmGeubt
4 Replies

5. Shell Programming and Scripting

Redirecting output to file

Hi, Below is the whole string which is to be redirected to the new file. su - oracle -c "exp $user/$pass file=/oracle/oradata/backup/exp_trn_tables_`date +%d_%b_20%y_%H_%M_%S`.dmp log=/oracle/oradata/backup/exp_trn_tables_`date +%d_%b_20%y_%H_%M_%S`.log tables=table1,table2 statistics=none" ... (3 Replies)
Discussion started by: milink
3 Replies

6. Shell Programming and Scripting

help redirecting output from mailbot

Hello...I'm having problems redirecting output from a script from a mailbot. It is a perl script that has the email sent to op_shipper piped into it. I am receiving the email with sendmail and here is what my alias looks like for the script am I having problems with in /etc/aliases: ... (3 Replies)
Discussion started by: kuliksco
3 Replies

7. UNIX for Dummies Questions & Answers

Redirecting 'find' output...

Hi all, why does one version of this command work but not the other? - This file already exists with 644 mod permissions - I am logged in as d269836, no su rights. - Box is 'SunOS' running bash I think; but runs ksh scripts OK. This one works: find /users/d269836 -type f -name "*.txt"... (6 Replies)
Discussion started by: dan-e
6 Replies

8. Shell Programming and Scripting

Redirecting OUTPUT

Hi, I want to move the output of a command/script to a file as well as to to be displayed on stdout. Can anybody help me in this. Thanks in advace .. -Chanakya M (1 Reply)
Discussion started by: Chanakya.m
1 Replies

9. UNIX for Advanced & Expert Users

redirecting the output of aspell

Hi, I have 2 identical servers both running aspell but for some reason I can't redirect the output to a file on one of them. This is what I'm trying to do: echo feck | aspell -l > errors.txt On one machine this works fine but the other it doesn't (the file is created but it is empty). ... (6 Replies)
Discussion started by: leekb
6 Replies

10. UNIX for Dummies Questions & Answers

Redirecting the startup output

Is there any way to redirect the output of the startup of a sun E250. Im basically trying to troubleshoot some init scripts and it would be useful to have a log of the startup output. (3 Replies)
Discussion started by: blakmk
3 Replies
Login or Register to Ask a Question