Read from text file;format and print output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Read from text file;format and print output
Prev   Next
# 1  
Old 03-22-2013
Read from text file;format and print output

Hi Following is the assumed input...
Code:
Symmetrix ID        : 12345

Originator Port wwn : 123456789
User-generated Name : 123456789/123456789

Sym Dev  Dir:P                                            LUN
------  -----  -----------------------  ----  ---  ---- ----  ----  -------
1234     8A:1  Not Visible                 0    0    61  N/A  (M)     17261
5678     8C:1  Not Visible                 0    0    75  N/A  (M)     25892
9123     8C:1  Not Visible                 0    0    80  N/A  (M)    153563
4567     8A:1  Not Visible                 0    0    67  N/A          219
Symmetrix ID        : 12345

Originator Port wwn : 123456789
User-generated Name : 123456789/123456789

Sym Dev  Dir:P                                            LUN
------  -----  -----------------------  ----  ---  ---- ----  ----  -------
1234     8A:1  Not Visible                 0    0    61  N/A  (M)     17261
5678     8C:1  Not Visible                 0    0    75  N/A  (M)     25892

Symmetrix ID        : 12345

Originator Port wwn : 123456789
User-generated Name : 123456789/123456789

Sym Dev  Dir:P                                            LUN
------  -----  -----------------------  ----  ---  ---- ----  ----  -------
1234     8A:1  Not Visible                 0    0    61  N/A  (M)     17261
5678     8C:1  Not Visible                 0    0    75  N/A  (M)     25892
9123     8C:1  Not Visible                 0    0    80  N/A  (M)    153563


I need output as below:
Code:
Originator Port WWN        Sym Dev             Dir:P

123456789        1234,5678,9123,4567    8A:1,8C1,8A1,8C1
123456789        1234,5678        8A:1,8C1
123456789        1234,5678,9123        8A:1,8C1,8A1


Please help .tried using awk but dint help

Last edited by Franklin52; 03-22-2013 at 05:00 AM.. Reason: Please use code tags for data and code samples
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Convert rows to column and print output in required format

Hi All, i am trying to print the solaris 11 packages in below required format, But i am unable to do that. Current ouput : root@abc# pkginfo -l | egrep '(BASEDIR|NAME|VERSION)' | awk '{print}' NAME: QLogic 570x/571x Gigabit Ethernet Driver VERSION: 11.11,REV=2009.11.11 ... (7 Replies)
Discussion started by: balu1234
7 Replies

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

3. Shell Programming and Scripting

Read in search strings from text file, search for string in second text file and output to CSV

Hi guys, I have a text file named file1.txt that is formatted like this: 001 , ID , 20000 002 , Name , Brandon 003 , Phone_Number , 616-234-1999 004 , SSNumber , 234-23-234 005 , Model , Toyota 007 , Engine ,V8 008 , GPS , OFF and I have file2.txt formatted like this: ... (2 Replies)
Discussion started by: An0mander
2 Replies

4. Programming

Read text from file and print each character in separate line

performing this code to read from file and print each character in separate line works well with ASCII encoded text void preprocess_file (FILE *fp) { int cc; for (;;) { cc = getc (fp); if (cc == EOF) break; printf ("%c\n", cc); } } int main(int... (1 Reply)
Discussion started by: khaled79
1 Replies

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

6. Shell Programming and Scripting

Read a text file and print the content..

hello all i request you to give the solution for the following problem.. I want read the text file.and print the contents character by character..like if the text file contains google means..i want to print g go goo goog googl google like this Using unix Shell scripting... ... (7 Replies)
Discussion started by: samupnl
7 Replies

7. Shell Programming and Scripting

read the text file and print the content character by character..

hello all i request you to give the solution for the following problem.. I want read the text file.and print the contents character by character..like if the text file contains google means..i want to print g go goo goog googl google like this Using unix Shell scripting... without using... (1 Reply)
Discussion started by: samupnl
1 Replies

8. Shell Programming and Scripting

Dynamic output file generation using a input text file with predefined output format

Hi, I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format. Example: File.txt AP|{SSHA}VEEg42CNCghUnGhCVg== APVG3|{SSHA}XK|"password" AP3|{SSHA}XK|"This is test" .... etc --------- test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies

9. Shell Programming and Scripting

Net::SSH::Perl ...... how to print the output in a proper format

Hi Guys, my $cmd = "ls -l"; #........ {or let it be as # my $cmd= "ls"; } my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd("$cmd"); print $stdout; the script works fine, but i am unable to see the output getting displayed in a... (7 Replies)
Discussion started by: gsprasanna
7 Replies

10. UNIX for Dummies Questions & Answers

format output from while read line

I have an output that I get from while read, I want to display it as the following, please help. Original output from while read line loop: This is my client=1 client version=2.3.4 OS version=4.5 This is my client=2 client version=1.5.6 OS version=6.7 I want it to look like this with... (7 Replies)
Discussion started by: dala
7 Replies
Login or Register to Ask a Question