checking multi lines with if


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers checking multi lines with if
# 1  
Old 03-09-2011
checking multi lines with if

hi all,

i have a file containing list of dials as below with some extra field as below
Code:
####### 20101665110 #######
MSISDN=20101665110 TC=15000.0 TU=2011-03-02T19:39:03Z
MSISDN=20101665110 TC=15000.0 TU=2011-03-02T19:39:04Z
MSISDN=20101665110 TC=15000.0 TU=2011-03-02T19:39:04Z
####### 20102873968 #######
MSISDN=20102873968 TC=350.0 TU=2011-03-02T16:49:41Z
MSISDN=20102873968 TC=350.0 TU=2011-03-02T16:49:42Z
MSISDN=20102873968 TC=350.0 TU=2011-03-02T16:49:43Z

i need to check evey dial for all its output
is it the same TC and same TU=yyyy-mm-ddThh:mm then redirect it to a file else redirect it to another one

Last edited by vbe; 03-09-2011 at 09:35 AM.. Reason: code tags please
# 2  
Old 03-09-2011
why not just take 2 passes:

grep ONE-STRING file_nm > this_file
grep OTHER-STRING file_nm > this_other_file

Or, to separate all unique TU's to their own files:

Code:
grep TU= file_name |
sed -e 's/^TU=//' -e 's/T.*$//' |
while read uniq_date ; do

  grep TU=${uniq_date}T file_name > new_file.$uniq_date

done

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search multi lines in to multiple files

how to find multiple lines in to multiple files if matched lines then do f1 f2 f3 are files ,lines contain matched lines f1 asdasdasdasd asdasdasdasd abc def Business date cannot be as of date ghi sdasdasdasda asdasdasdada f2 (1 Reply)
Discussion started by: Kalia
1 Replies

2. Shell Programming and Scripting

How to format output in columns by appending multi lines one by one?

Hi, I need to display output in below format Customer : Apr 24 16:31 Customer_Name_111121.txt |---Space---|Apr 24 16:32 Customer_Name _111121. txt |---Space---|Apr 24 16:34 Customer_Name_111112. txt |---Space---|Apr 24 16:35 Customer_Name _222223. txt |---Space---|Apr 24 16:37... (8 Replies)
Discussion started by: ketanraut
8 Replies

3. Shell Programming and Scripting

sed to replace a line with multi lines from a var

I am trying to find a line in a file ("Replace_Flag") and replace it with a variable which hold a multi lined file. myVar=`cat myfile` sed -e 's/Replace_Flag/'$myVar'/' /pathto/test.file myfile: cat dog boy girl mouse house test.file: football hockey Replace_Flag baseball ... (4 Replies)
Discussion started by: bblondin
4 Replies

4. Shell Programming and Scripting

joining multi-line file into single lines

Hi, I have a file like mentioned below..For each specific id starting with > I want to join the sequence in multiple lines to a single line..Is there a simple way in awk or sed to do this >ENST00000558922 cdna:KNOWN TCCAGGATCCAGCCTCCCGATCACCGCGCTAGTCCTCGCCCTGCCTGGGCTTCCCCAGAG... (2 Replies)
Discussion started by: Diya123
2 Replies

5. Shell Programming and Scripting

replacing multi lines with 1 line

I have an xml file that is stripped down to output that looks bacically like; <!-- TABLEA header --> <tablea> some fields </tablea> <!-- TABLEB header --> <!-- TABLEC header --> <tablec> some fields </tablec> I want to remove the header... (3 Replies)
Discussion started by: Griffs_Revenge
3 Replies

6. Shell Programming and Scripting

Multi lines to single line

HI, My input file contains the data as like below: A1234119993 B6271113 Bghjkjk A1234119992 B6271113hi Bghjkjkmkl the output i require is : A1234119993 B6271113 Bghjkjk A1234119992 B6271113hi Bghjkjkmkl Please help me in this. Thanks (6 Replies)
Discussion started by: pandeesh
6 Replies

7. Shell Programming and Scripting

Help on Merge multi-lines into one single line

Hello, Can anyone let me know how to use Perl script to Merge following multi-lines into one single line... ***** Multi-line***** FILE_Write root OK Tue Jul 01 00:00:00 2008 cl_get_path file descriptor = 1 FILE_Write root OK ... (5 Replies)
Discussion started by: happyday
5 Replies

8. Shell Programming and Scripting

Merge multi-lines into one single line

Hi, Can anyone help me for merge the following multi-line log which beginning with a number and time: into one line. For each line need to delete the return and add a space. Please see the red color line. *****Original Log*****... (4 Replies)
Discussion started by: happyday
4 Replies

9. Shell Programming and Scripting

print a multi-lines variable?

hi im trying a make simple html page with the content of some files i have: title=`cat "file1"` heading=`cat "file2"` para=`cat "file3"` block=`cat "/file4"` cat > ./page.html <<-EOF <html> ... (2 Replies)
Discussion started by: rockbike
2 Replies

10. Shell Programming and Scripting

merge multi-lines into one line

Hi, Can anyone help me for merge the following multi-line logs( the black lines) which beginning with time: into one line. For the line with "-", it needs to be deleted. Please see the red color line. ######################################### time: 20080817073334 dn: uid=ok,ou=nbt... (3 Replies)
Discussion started by: missyou
3 Replies
Login or Register to Ask a Question