How to test many texts generated by many commands ?


 
Thread Tools Search this Thread
Top Forums Programming How to test many texts generated by many commands ?
# 1  
Old 10-19-2011
How to test many texts generated by many commands ?

Hello, I have hundreds of text files to be tested.They are generated by many commands. I should check whether a word in specific position is right, or whether a word in file A is equal to a word in file B. All the file are not the same. I decide to use shell to test every files, so I had to write hundreds of test shell scripts. My God!
Can anyone give me a handy way to do all the tests. Or is there any tool or language is for doing these tests ?
For example:
Code:
CLS_SBB => log_display
system operation number:19
No.      Type    Time    Ele type        Ele ID          Event type      Attribute
0        02      459     07      00      92      00      00      00      01
1        02      00      07      00      83      01      cb      ce      08
2        02      00      07      00      83      01      cb      ce      08
3        02      00      07      00      82      01      80      00      00

Code:
CLS_SBB => log_show
------------------------------------------------ Local Event Log------------------------------------------------------------------------
No.    Time            Element Name                      Event Type                 Event Dir        Event Range       Event Data              Severity
0001   00:00:18:33     Leopard-H Canister A              Log Repository Cleared     N/A              N/A               N/A                     Info
0002   00:00:00:00     Leopard-H Canister A              Firmware Configuration Invalid              N/A               N/A                     Warning
0003   00:00:00:00     Leopard-H Canister A              Firmware Configuration Invalid              N/A               N/A                     Warning
0004   00:00:00:00     Leopard-H Canister A              POST Error                 N/A              N/A               POST step ID 128        Warning

Compile rule
Row : No.
The corresponding value should be equal.e.g. 0=0001
Row : Time:
e.g. 459=18*60+33
Row : Ele Type
e.g. 07 should be Leopard-H Canister. . and other device id is other device.
....
I should do the work for many files, it's hard for me.
Thanks!
# 2  
Old 10-20-2011
Not much to go on specifically here, so I will give general advice. First, try "awk" which splits lines into words (you can define what a word is). It's handy and can solve many complex problems, but not everything. If awk is not enough, perl will handle the job.
# 3  
Old 10-20-2011
They may not all be the same, but those two do at least look similar: The first three lines are to be ignored.

The third line is column information.

They're all separated either by tabs, or several spaces in a row.

Do they have anything else in common?
# 4  
Old 10-21-2011
Yes, you are right. every column has it's relationship with one column in another file. The compare work is too much.
# 5  
Old 10-21-2011
So..... right about which things?

You said they were all different, too... In what ways are they different?
# 6  
Old 10-23-2011
The format of every file is similar, each column stands for one meaning,and can be compared with the another column in another file.
# 7  
Old 10-23-2011
yeah, learn to use awk.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Aligning Texts

is there any way to align my text so every column begins on the same line as the previous line? here's my command: printf "THEN ( ${SEARCHPATTB} = Hour = ${CALTOTB} ) %8s => %8s NOW ( ${SEARCHPATT} = Hour = ${CALTOT} ) %7s => %7s Reduced By: %7s -${RESULT}"\\n output i'm currently getting... (2 Replies)
Discussion started by: SkySmart
2 Replies

2. Shell Programming and Scripting

File test commands with variable file name

Hi there I have the following code SDFFILE_SRC=$BACKEND_DIR/$SDFFILE_MIN_tar SDFFILE_DST=$SIM_DIR/$SDFFILE_MIN if ] .... .... .... fi Simply I need to check if $SDFFILE_SRC isa newer than $SDFFILE_DST or $SDFFILE_DST does not exist then execute the IF Body. Although the the... (2 Replies)
Discussion started by: aelhosiny
2 Replies

3. Post Here to Contact Site Administrators and Moderators

Can there be alt-texts to icons?

Can you add hover texts (alt-texts) to icons? It is not always obvious what each of them mean just by looking at them. Sometimes it is clear from the url it points to, but for accessibility reasons alone it would be good to have alt-texts as a standard. (1 Reply)
Discussion started by: figaro
1 Replies

4. UNIX for Dummies Questions & Answers

Texts between 2 strings

Hi, I have a file with texts shown below, <2013 abc <2013 start request pdu dot1q end pdu response pdu dot1q end pdu am searching for the text "dot1q" , when it matches in the file , i need the contents between "<2013 start" and "end pdu". Can some one help on this ? ... (5 Replies)
Discussion started by: giri_luck
5 Replies

5. UNIX for Dummies Questions & Answers

How to test commands in files?

Hi. I'm new here, and I'm trying to enter this big world of unix. I would like to know how can I install a SSH server for free so I can teste some things, like make a file, change files, rename and things like this? If is there any easy way to test all commands it would be interesting too. ... (10 Replies)
Discussion started by: whity
10 Replies

6. Shell Programming and Scripting

How to concatenate texts in perl only?

Hi, I want to concatenate the texts in the file but there are different scenario's. Ist Scenario. The contents of file has id`language,sequence number,text,language Here id`language is a key pair to identify the correct language. Sequnce number is the order the text being inserted. Text... (3 Replies)
Discussion started by: vanitham
3 Replies

7. Shell Programming and Scripting

extract texts using awk

Hello, I have two files: File1: a b c d File2: b c e I need 'e' as output.... Thanks.. ---------- Post updated at 12:16 PM ---------- Previous update was at 12:15 PM ---------- (1 Reply)
Discussion started by: shekhar2010us
1 Replies

8. Shell Programming and Scripting

copy and merge texts between two pattern

I need 1. to find all the files from a Folder "folder_name" and from its 4 or 5 sub folders which contain a certain pattern "pattern1". 2. from these files copy and merge all the text between "pattern1" and another different pattern "pattern2" to "mergefile". 3. Get rid of every html tag. 4.... (3 Replies)
Discussion started by: mjomba
3 Replies

9. Shell Programming and Scripting

How to check weather a string is like test* or test* ot *test* in if condition

How to check weather a string is like test* or test* ot *test* in if condition (5 Replies)
Discussion started by: johnjerome
5 Replies

10. Shell Programming and Scripting

Test on string containing spacewhile test 1 -eq 1 do read a $a if test $a = quitC then break fi d

This is the code: while test 1 -eq 1 do read a $a if test $a = stop then break fi done I read a command on every loop an execute it. I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test. For example echo hello. Now the... (1 Reply)
Discussion started by: Max89
1 Replies
Login or Register to Ask a Question