Sponsored Content
Top Forums Shell Programming and Scripting Perl : Process a file in perl Post 302355302 by deo_kaustubh on Tuesday 22nd of September 2009 09:22:42 AM
Old 09-22-2009
Perl : Process a file in perl

I have a file with following data :

Code:
Qspace: COLOR: Queue: doColor
Qspace: COLOR: Queue order: fifo
Qspace: COLOR: Out of order: none
Qspace: COLOR: Retries: 5
Qspace: COLOR: Queue: setColor
Qspace: COLOR: Queue order: fifo
Qspace: COLOR: Out of order: none
Qspace: COLOR: Retries: 5
Qspace: COLOR
Qspace: MatchSpace: Queue: getColor
Qspace: MatchSpace: Queue order: fifo
Qspace: MatchSpace: Out of order: none
Qspace: MatchSpace: Retries: 10
Qspace: MatchSpace
:
:

I am looking for an output like,

Code:
Qspace: COLOR: Queue: doColor
Qspace: COLOR: Queue: doColor: Queue order: fifo
Qspace: COLOR: Queue: doColor: Out of order: none
Qspace: COLOR: Queue: doColor: Retries: 5
Qspace: COLOR: Queue: setColor
Qspace: COLOR: Queue: setColor: Queue order: fifo
Qspace: COLOR: Queue: setColor: Out of order: none
Qspace: COLOR: Queue: setColor: Retries: 5
Qspace: COLOR
Qspace: MatchSpace: Queue: getColor
Qspace: MatchSpace: Queue: getColor: Queue order: fifo
Qspace: MatchSpace: Queue: getColor: Out of order: none
Qspace: MatchSpace: Queue: getColor: Retries: 10
Qspace: MatchSpace

For each Qspace there is/are queue/s associated with it. I need to append name of each Qspace & Queue with every attribute.

Last edited by vgersh99; 09-22-2009 at 10:24 AM.. Reason: code tags, PLEASE!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: Run perl script in the current process

I have a question regarding running perl in the current process. I shall demonstrate with an example. Look at this. sh-2.05b$ pwd /tmp sh-2.05b$ cat test.sh #! /bin/sh cd /etc sh-2.05b$ ./test.sh sh-2.05b$ pwd /tmp sh-2.05b$ . ./test.sh sh-2.05b$ pwd /etc sh-2.05b$ So... (10 Replies)
Discussion started by: vino
10 Replies

2. Shell Programming and Scripting

perl -write values in a file to @array in perl

Hi can anyone suggest me how to write a file containing values,... say 19 20 21 22 .. 40 to an array @array = (19, 20, ... 40) -- Thanks (27 Replies)
Discussion started by: meghana
27 Replies

3. Shell Programming and Scripting

how to get process id in perl

Hey guys, how can i get process id of some particular command in perl? example: $cmd = "date; sleep 10; date&"; system($cmd); How can i get process id of system command? (2 Replies)
Discussion started by: RohitKJ
2 Replies

4. Shell Programming and Scripting

Perl :How to print the o/p of a Perl script on console and redirecting same in log file @ same time.

How can i print the output of a perl script on a unix console and redirect the same in a log file under same directory simultaneously ? Like in Shell script, we use tee, is there anything in Perl or any other option ? (2 Replies)
Discussion started by: butterfly20
2 Replies

5. Programming

Perl- How to catch the file in perl code?

Hi, plz see the below code , i have catch the file "Orders.20110714.out "file as a Orders*.out. but it giving me an error .it does not open the file. if the same thing i have done by code code-> ls Orders*.out then it gives me the output Orders.20110714.out i am trying apply the... (1 Reply)
Discussion started by: pspriyanka
1 Replies

6. Shell Programming and Scripting

How to put FTP process as a background process/job in perl?

Hi, I am using net::ftp for transferring files now i am trying in the same Linux server as a result ftp is very fast but if the server is other location (remote) then the file transferred will be time consuming. So i want try putting FTP part as a background process. I am unaware how to do... (5 Replies)
Discussion started by: vanitham
5 Replies

7. Shell Programming and Scripting

Perl SFTP, to get, sort and process every file.

Hi All, I'm niks, and i'm a newbie here and newbie also in perl sorry, i'm just wondering how can i get the file from the other hostname using sftp? then after i get it i'm going to sort the file and process it one by one. sorry because i'm a newbie. Thanks, -niks (4 Replies)
Discussion started by: nikki1200
4 Replies

8. Shell Programming and Scripting

Perl: How to read text from file and process $variable in that data too.

In the hello.htm have the sentenses: Hello $name How are you? The perl script: $name = "David"; open(HEADER,"hello.htm"); while(<HEADER>) { $html .= $_; } close(HEADER); print "$html";I making something about template. But it can't process the $name variable. (4 Replies)
Discussion started by: natong
4 Replies

9. Shell Programming and Scripting

Parallel process in Perl

HI All, I have scenerio where I need to call sub modules through for loop for (i=0; i<8000 ;i++) { .. BLOCKA } BLOCKA { .. .. subroutine 1; subroutine 2; } I want this to be run in parallel process1 BLOCKA { (6 Replies)
Discussion started by: gvk25
6 Replies

10. Programming

PERL: In a perl-scripttTrying to execute another perl-script that SETS SOME VARIABLES !

I have reviewed many examples on-line about running another process (either PERL or shell command or a program), but do not find any usefull for my needs way. (Reviewed and not useful the system(), 'back ticks', exec() and open()) I would like to run another PERL-script from first one, not... (1 Reply)
Discussion started by: alex_5161
1 Replies
set_color(1)                                                           fish                                                           set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 01:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy