TEXT formating using script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting TEXT formating using script
# 1  
Old 05-17-2009
TEXT formating using script

Dear All

I am facing problem while extracting data from below mention input file.
My op should be like this.Required field display in red in file.

Request you all to help.

OP:

RXOTX-46-5 1B4
RXOTX-46-4 2B5


INPUT FILE:
<RXMFP:MO=RXOTX-46-5;
RADIO X-CEIVER ADMINISTRATION
MANAGED OBJECT FAULT INFORMATION
MO BTSSWVER
RXOTX-46-5 ERA-G04-R11-V01
RU RUREVISION RUSERIALNO
0
RUPOSITION RULOGICALID


STATE BLSTATE INTERCNT CONCNT CONERRCNT LASTFLT LFREASON
NOOP BLO 00000
FAULT CODES CLASS 1B
4

FAULT CODES CLASS 1C
6
END

<RXMFP:MO=RXOTX-46-4;
RADIO X-CEIVER ADMINISTRATION
MANAGED OBJECT FAULT INFORMATION
MO BTSSWVER
RXOTX-46-4 ERA-G04-R11-V01
RU RUREVISION RUSERIALNO
0
RUPOSITION RULOGICALID

STATE BLSTATE INTERCNT CONCNT CONERRCNT LASTFLT LFREASON
NOOP BLO 00000
FAULT CODES CLASS 2B
5

END

regards
jaydeep
# 2  
Old 05-17-2009
how about showing some code. you have similar thread here.
# 3  
Old 05-17-2009
Code:
awk '/^RXOTX/{printf("%s ", $1)}
/^NOOP/{getline;printf("%s", $NF);getline;printf("%s\n", $0)}' file


cheers,
Devaraj Takhellambam
# 4  
Old 05-18-2009
perl:

Code:
undef $/;
open $fh,"<","a.txt";
my $str=<$fh>;
while (my ($a,$b,$c)=($str=~/\<.*?\n.*?\n.*?\n.*?\n([^ ]+).*?FAULT CODES CLASS (.*?\n[^ ]+)\n.*?END(.*)/s)){
	$b=~s/\n//;
	print $a,"---",$b,"\n";
	$str=$c;
}

# 5  
Old 05-18-2009
thanks devraj..its work..Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File formating

I need to create a fixed width file based on the column lengths. lets assume I have six(this may be dynamic) fields each are of different length column1=6 #size of the column column2=3 column3=2 column4=3 column5=4 column6=5 I tried below code snippet but it is not working echo... (4 Replies)
Discussion started by: gvkumar25
4 Replies

2. UNIX for Beginners Questions & Answers

File formating help

Hi all, I am having the file below I need that as below Thanks, Arun (12 Replies)
Discussion started by: arunkumar_mca
12 Replies

3. Shell Programming and Scripting

Text Formating or Modifying

Hi Experts, I have a text exactly like below in a file: id item_id item_date prin_mkt_val --------------------------- --------------------------- ------------------------------- ------------------------ ... (1 Reply)
Discussion started by: apatil65
1 Replies

4. Shell Programming and Scripting

Text formating issue

Hi, I am trying to format the output of my script in a tabular format using the html code in my shell script. I am using html code for the first time in a shell script.I am trying to execute this script in Ksh but it is not getting executed. Can you please help me in figuring this out.... (6 Replies)
Discussion started by: isaacsam
6 Replies

5. Shell Programming and Scripting

Text formating

Dear all I had input file as mention below and want op as mention. Kindly let me knw possible ways. Regards Jaydeep INPUT: RXOTX-48-1 2A 34 2B 35 RXOTX-499-2 2C 32 RXOTX-4-1 2D 23 OUTPUT: (3 Replies)
Discussion started by: jaydeep_sadaria
3 Replies

6. Shell Programming and Scripting

formating date

Guys I have a date value like this in a table -> 2006-12-29 12:57:08(data type varchar2(25)) I am trying to subtract this column from sysdate. I am unable to do that. can u guys suggest me a way to do this.. (2 Replies)
Discussion started by: ragha81
2 Replies

7. Forum Support Area for Unregistered Users & Account Problems

Formating mailx text file for Lotus Notes users

We use AIX mailx or sendmail. How can I format a text file so that lotus notes users can see diferent fonts and highlighting. Or can a gif file (company logo..) be sent along with a text file and the Lotus notes user would see the logo and text displayed at the same time and not as an attachment? (0 Replies)
Discussion started by: lidoiwo
0 Replies

8. UNIX for Dummies Questions & Answers

Formating text from a script into a log file

Using a for loop I am able to get the following log file below. I would like o change the format a bit as is indicated lower down. I have looked at awk and sed but somehow is not getting any joy. I am a bit new to ksh scripting. Please assist. This is the format of my current log file after the... (1 Reply)
Discussion started by: hugow
1 Replies

9. UNIX for Dummies Questions & Answers

text formating/Text space padding

Hi, How do I format the following? I have a for loop that retrieves me the path and file name of a file. In column fashion I would like to add the time and another variable containing the file's size. This will result in all the time being under each other and all the file size's being under... (6 Replies)
Discussion started by: hugow
6 Replies

10. UNIX for Dummies Questions & Answers

Formating in Echo?

Hi, In my code: echo " Field1 " " Filed2 " " Filed3 " >> $myfile echo "--------" "------- " "--------">> $myfile echo $value1 $value2 $value3 >> $myfile echo $value1 $value2 $value3 >> $myfile echo $value1 $value2 $value3 >> $myfile My file... (4 Replies)
Discussion started by: redlotus72
4 Replies
Login or Register to Ask a Question