add txt


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting add txt
# 1  
Old 04-23-2011
add txt

=300 same text
=541 same text
=952 p000298
=952 p000299

=050 same text1
=082 same text1
=952 p002930
=952 p002931

Possible to add every sequence of =952%. add last sequence
=LDR 00000nam
out put

=300 same text
=541 same text
=952 p000298
=952 p000299

=LDR 00000nam
=050 same text1
=082 same text1
=952 p002930
=952 p002931

=LDR 00000nam
# 2  
Old 04-23-2011
Code:
awk '{if(/^=952/){if(!t){t=1}}else if(t){print "=LDR 00000nam"; t=""}} 1; END{if(t)print "=LDR 00000nam"}' infile

# 3  
Old 04-23-2011
Try this

Code:
awk '!/=952/{if(f==1){x="=LDR 00000nam";f=0;print x}}/=952/{f=1}1;END{if(f==1){print x}}' file

regards,
Ahamed

Last edited by ahamed101; 04-23-2011 at 03:24 AM..
# 4  
Old 04-23-2011
thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How can i add each line from a txt file to different files in the same directory?

Hello, this is my first thread here :) So i have a text file that contains words in each line like abcd efgh ijkl mnop and i have 4 txt files, i want to add each line to each file, like file 1 gets abcd at the end; file 2 gets efgh at the end .... I tried with: cat test | while read -r... (6 Replies)
Discussion started by: azaiiez
6 Replies

2. Shell Programming and Scripting

Search last column of INPUT.txt in TABLEs text and add correspond columns to INPUT.txt

Hi dears i use bash shell i have INPUT.txt like this number of columns different in one some row have 12 , some 11 columns see last column INPUT.txt CodeGender Age Grade Dialect Session Sentence Start End Length Phonemic Phonetic 63 M 27 BS/BA TEHRANI 3 4 298320 310050... (2 Replies)
Discussion started by: alii
2 Replies

3. Windows & DOS: Issues & Discussions

2 Questions: replace text in txt file, add text to end of txt file

so... Lets assume I have a text file. The text file contains multiple "#" symbols. I want to replace all thos "#"s with a STRING using DOS/Batch I want to add a certain TEXT to the end of each line. How can I do this WITHOUT aid of sed, grep or anything linux related ? (1 Reply)
Discussion started by: pasc
1 Replies

4. Shell Programming and Scripting

Add similar pairs in a txt file

Hi guys!!! In my txt file there are a lot of pairs. Some of them are similar, so I am trying to add these pairs. For a example: File: ASP - GLN = 14 SER - GLU = 14 ARG - ASN = 13 ARG - TYR = 13 ASP - ARG = 13 GLU - ARG = 13 GLU - GLN = 13 ALA - ARG = 12 ... (7 Replies)
Discussion started by: Tzole
7 Replies

5. UNIX for Dummies Questions & Answers

Add a new column to txt file containing filename

I would like help adding a new column to a large txt file (~10MB) that contains the filename. I have searched other posts but have not found an adequate solution. I need this extra column so I can concatenate >100 files and perform awk searches on this large file. My current txt file look... (4 Replies)
Discussion started by: kellywilliams
4 Replies

6. UNIX for Dummies Questions & Answers

how to add or delete blank space in .txt

dear all, i have a question. i have a data which looks like below rs123 AATTTTTGGGGGGCC... rs456 TTTTTTCCCCCCCCC... rs5767 TTTTTTTGGGGGGCC... rs89776 GGGGCCCCCCCCC... WHAT I WANT is adding blank space as below: rs123 AA TT TT TG GG GG GC ... rs456 TT TT TT CC CC CC CC ... rs5767... (3 Replies)
Discussion started by: forevertl
3 Replies

7. Shell Programming and Scripting

how to add extra a field in a flat txt file ?

Hi all, I did not use UNIX for a long time, now i need to make a flat file with extra field, can you help me with the code ? 1. I create a last line of each log from each system and make it in a flat text file (seperate by a pipe |) mv current.log old tail -1 sanfrancisco.log > current.log... (5 Replies)
Discussion started by: britney
5 Replies

8. Shell Programming and Scripting

Generate a mail when you add info to a txt file

Hi, I have an application's log file: /var/log/logfile which is feeded from time to time due to an application. This file contains data, what I want is: -Whenever some new data is copied to /var/log/logfileI want to generate an email to root BUT only with the new added data in the body.... (6 Replies)
Discussion started by: iga3725
6 Replies

9. UNIX for Dummies Questions & Answers

echo "ABC" > file1.txt file2.txt file3.txt

Hi Guru's, I need to create 3 files with the contents "ABC" using single command. Iam using: echo "ABC" > file1.txt file2.txt file3.txt the above command is not working. pls help me... With Regards / Ganapati (4 Replies)
Discussion started by: ganapati
4 Replies

10. Shell Programming and Scripting

add last lineline in all the .txt files

Hi Friends, I want to add "AAAAAAAAAAAAAAAAAAAAAAAAAA" in the last line of each .txt files in a particular directry. How to do this ? Thanks In advsnce (1 Reply)
Discussion started by: bikas_jena
1 Replies
Login or Register to Ask a Question