Sponsored Content
Top Forums Shell Programming and Scripting Append a searched string with another string using sed Post 302708099 by vchee on Monday 1st of October 2012 04:30:12 AM
Old 10-01-2012
Quote:
Originally Posted by elixir_sinari
Please post the contents of test.txt and mention what you need to do to get the final/required output along with the required output. This way you might get a better solution than the unnecessary pipeline.
The Text is as follows,
Code:
mars            IN      A       202.27.17.78
sentosa         IN      A       202.27.17.100
www             IN      CNAME   mars
majordomo       IN      CNAME   mars
smtp2           IN      CNAME   sentosa
smtp3           IN      CNAME   venus.test.com.

Script suppose to grep for CNAME without the "." at the end and append them with .test.com. so that the above will become,
Code:
mars            IN      A       202.27.17.78
sentosa         IN      A       202.27.17.100
www             IN      CNAME   mars.test.com.
majordomo       IN      CNAME   mars.test.com.
smtp2           IN      CNAME   sentosa.test.com.
smtp3           IN      CNAME   venus.test.com.

Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search for a string and replace the searched string in the same position

Hi All, My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found..The issue is the last... (15 Replies)
Discussion started by: ganesh_248
15 Replies

2. UNIX for Dummies Questions & Answers

Search for a string and replace the searched string in the same position in samefile

Hi All, My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found in the same file..The... (27 Replies)
Discussion started by: ganesh_248
27 Replies

3. Shell Programming and Scripting

put a string before a searched string

hi all! i have a working that looks like this... file1 MALE JOHN MALE ANJO FEMALE ANNE MALE JAMES FEMALE HONEY FEMALE IZA what i want to do is insert "M" when the first string is "MALE" and insert "F" when the first string is "FEMALE". file1 M MALE ... (10 Replies)
Discussion started by: kingpeejay
10 Replies

4. Shell Programming and Scripting

greping last occurrence of the searched string

Hello, I have active log file i want to grep the last occurrence of the word in that log file the log file gets on increasing and increasing i want to fetch it from live file. Please guide me, Thanks in advance (4 Replies)
Discussion started by: vidurmittal
4 Replies

5. Shell Programming and Scripting

sed append to string

I am trying to replace in multiple files every instance of text that begins with http and add hyperlink characters to it. I can get it to work with the following:sed -e "s/http*.*/<a href=\"&\">&<\/a>/g" * as long as the http text is at the end of the file. I need it to stop at the end of the... (2 Replies)
Discussion started by: numele
2 Replies

6. Shell Programming and Scripting

sed to find first appearance and append string

I have a file like below #GROUP A belongs to Asia GROUP A jojh hans local admin GROUP A gege fans michel jing jong #GROUP U belongs to USA GROUP U jeff goal hello world My requirement is to grep for first apperence of GROUP A which is not commented and append my name to end of file.... (12 Replies)
Discussion started by: vkk
12 Replies

7. UNIX for Dummies Questions & Answers

Append a string on the next line after a pattern string is found

Right now, my code is: s/Secondary Ins./Secondary Ins.\ 1/g It's adding a 1 as soon as it finds Secondary Ins. Primary Ins.: MEDICARE B DMERC Secondary Ins. 1: CONTINENTAL LIFE INS What I really want to achieve is having a 1 added on the next line that contain "Secondary Ins." It... (4 Replies)
Discussion started by: newbeee
4 Replies

8. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

9. Shell Programming and Scripting

sed - Find a String and append a text end of the Line

Hi, I have a File, which have multiple rows. Like below 123456 Test1 FNAME JRW#$% PB MO Approver XXXXXX. YYYY 123457 Test2 FNAME JRW#$% PB MO Super XXXXXX. YYYY 123458 Test3 FNAME JRW#$% PB MO Approver XXXXXX. YYYY I want to search a line which contains PB MO Approver and append... (2 Replies)
Discussion started by: java2006
2 Replies

10. Shell Programming and Scripting

Search String and extract few lines under the searched string

Need Assistance in shell programming... I have a huge file which has multiple stations and i wanted to search particular station and extract few lines from it and the rest is not needed Bold letters are the stations . The whole file has multiple stations . Below example i wanted to search... (4 Replies)
Discussion started by: ajayram_arya
4 Replies
Participants and synchronization sources.(3)                 Library Functions Manual                 Participants and synchronization sources.(3)

NAME
Participants and synchronization sources. - Classes class SDESItemsHolder Holds the SDES items and related information from a participant in an RTP application. class Participant A class of objects representing remote participants (RTP applications) in a multimedia session. class SyncSource Synchronization source in an RTP session. class RTPApplication An RTP application, holding identifying RTCP SDES item values. Functions __EXPORT RTPApplication & defaultApplication () Get the RTPApplication object for the 'default' application (the only one used by common applications -those that only implement one 'RTP application'). Detailed Description Function Documentation __EXPORT RTPApplication& defaultApplication () Get the RTPApplication object for the 'default' application (the only one used by common applications -those that only implement one 'RTP application'). Note that this application object differs from all the others that may be defined in that it is automatically constructed by the ccRTP stack and its CNAME is automatically assigned (as user@host), whereas the other application objects' CNAME is provided to its constructor. Examples: ccrtptest.cpp, rtphello.cpp, rtplisten.cpp, and rtpsend.cpp. Author Generated automatically by Doxygen for ccRTP from the source code. ccRTP Sat Jun 23 2012 Participants and synchronization sources.(3)
All times are GMT -4. The time now is 04:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy