Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Search a string in the file and then replace another string after that position Post 302529693 by yazu on Friday 10th of June 2011 04:40:38 AM
Old 06-10-2011
Code:
% cat testfile
Hello
Name: Nitin Raj
Welcome to Unix World.
This is very helpful
.
.
.
Hello
Name: ?ashing
This is nice forum.

% cat testfile | sed '/Hello/ n; s/Name/IDENTITY/'
Hello
IDENTITY: Nitin Raj
Welcome to Unix World.
This is very helpful
.
.
.
Hello
IDENTITY: ?ashing
This is nice forum.

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find the position of a string and replace with another string

Hi, I have a file named "Test_2008_01_21" The file contains a string "manual" that occurs many times in the file How can i find the positions of the string "manual" in the file Ex: if the string " manual " occurs three times in the file. i want to replace the second occurance of string... (6 Replies)
Discussion started by: bab123
6 Replies

2. 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

3. 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

4. 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

5. Shell Programming and Scripting

Search a string in a text file and add another string at the particular position of a line

I am having a text file which is having more than 200 lines. EX: 001010122 12000 BIB 12000 11200 1200003 001010122 2000 AND 12000 11200 1200003 001010122 12000 KVB 12000 11200 1200003 In the above file i want to search for string KVB and add/replace... (1 Reply)
Discussion started by: suryanarayana
1 Replies

6. Shell Programming and Scripting

Search string at a particular position in a file

Hi, i have a text file as : abc 0 1 Pass hjk 1 1 Pass bhk 0 0 Fail jjh 8 2 Pass nkji 0 1 Pass Now I want to check that if 1st column is jjh , then , store the value of 3rd string of that line in a variable. Hence, 2... (8 Replies)
Discussion started by: Anamika08
8 Replies

7. Shell Programming and Scripting

Search for a string at a particular position and replace with blank based on position

Hi, I have a file with multiple lines(fixed width dat file). I want to search for '02' in the positions 45-46 and if available, in that lines, I need to replace value in position 359 with blank. As I am new to unix, I am not able to figure out how to do this. Can you please help me to achieve... (9 Replies)
Discussion started by: Pradhikshan
9 Replies

8. UNIX for Dummies Questions & Answers

Search for a string,delete the line and replace with new string in a file

Hi Everyone, I have a requirement in ksh where i have a set of files in a directory. I need to search each and every file if a particular string is present in the file, delete that line and replace that line with another string expression in the same file. I am very new to unix. Kindly help... (10 Replies)
Discussion started by: Pradhikshan
10 Replies

9. UNIX for Dummies Questions & Answers

How do I replace a string in file that is in a certain position with spaces?

I am trying to replace the string in position 26 through 35 of the data file with 10 spaces and I want the remaining file to stay as is, the record length is over 900 characters? I am trying to use the AWK and substr but I am not getting it formatted correctly. Before... (6 Replies)
Discussion started by: fnwine1500
6 Replies

10. UNIX for Beginners Questions & Answers

Search partial string in a file and replace the string - UNIX

I have the below string which i need to compare with a file and replace this string in the file which matches closely. Can anyone help me on this. string(Scenario 1)- user::r--,user::ourfrd:r-- String(Scenario 2)- user::r-- File **** # file: /local/Desktop/myfile # owner: me # group:... (6 Replies)
Discussion started by: sarathy_a35
6 Replies
SNMPv2-TM(7)								MIB							      SNMPv2-TM(7)

SNMPv2-TM DEFINITIONS ::= BEGIN

IMPORTS
MODULE-IDENTITY, OBJECT-IDENTITY, snmpDomains, snmpProxys, snmpModules FROM SNMPv2-SMI TEXTUAL-CONVENTION FROM SNMPv2-TC; snmpv2TM MODULE-IDENTITY LAST-UPDATED "9709250900Z" ORGANIZATION "IETF SNMPv2 Working Group" CONTACT-INFO " Marshall T. Rose Postal: Dover Beach Consulting, Inc. 420 Whisman Court Mountain View, CA 94043-2186 US Tel: +1 415 968 1052 E-mail: mrose@dbc.mtview.ca.us" DESCRIPTION "The MIB module for SNMPv2 Transport Mappings." REVISION "9709250900Z" DESCRIPTION "This MIB module is extracted from RFC 1906. It is modified by mbj@erlang.ericsson.se to be compilable. The MODULE-IDENTITY specification was added." ::= { snmpModules 0 } -- dummy -- SNMPv2 over UDP over IPv4 snmpUDPDomain OBJECT-IDENTITY STATUS current DESCRIPTION "The SNMPv2 over UDP transport domain. The corresponding transport address is of type SnmpUDPAddress." ::= { snmpDomains 1 } SnmpUDPAddress ::= TEXTUAL-CONVENTION DISPLAY-HINT "1d.1d.1d.1d/2d" STATUS current DESCRIPTION "Represents a UDP address: octets contents encoding 1-4 IP-address network-byte order 5-6 UDP-port network-byte order " SYNTAX OCTET STRING (SIZE (6)) -- SNMPv2 over OSI snmpCLNSDomain OBJECT-IDENTITY STATUS current DESCRIPTION "The SNMPv2 over CLNS transport domain. The corresponding transport address is of type SnmpOSIAddress." ::= { snmpDomains 2 } snmpCONSDomain OBJECT-IDENTITY STATUS current DESCRIPTION "The SNMPv2 over CONS transport domain. The corresponding transport address is of type SnmpOSIAddress." ::= { snmpDomains 3 } SnmpOSIAddress ::= TEXTUAL-CONVENTION DISPLAY-HINT "*1x:/1x:" STATUS current DESCRIPTION "Represents an OSI transport-address: octets contents encoding 1 length of NSAP 'n' as an unsigned-integer (either 0 or from 3 to 20) 2..(n+1) NSAP concrete binary representation (n+2)..m TSEL string of (up to 64) octets " SYNTAX OCTET STRING (SIZE (1 | 4..85)) -- SNMPv2 over DDP snmpDDPDomain OBJECT-IDENTITY STATUS current DESCRIPTION "The SNMPv2 over DDP transport domain. The corresponding transport address is of type SnmpNBPAddress." ::= { snmpDomains 4 } SnmpNBPAddress ::= TEXTUAL-CONVENTION STATUS current DESCRIPTION "Represents an NBP name: octets contents encoding 1 length of object 'n' as an unsigned integer 2..(n+1) object string of (up to 32) octets n+2 length of type 'p' as an unsigned integer (n+3)..(n+2+p) type string of (up to 32) octets n+3+p length of zone 'q' as an unsigned integer (n+4+p)..(n+3+p+q) zone string of (up to 32) octets For comparison purposes, strings are case-insensitive All strings may contain any octet other than 255 (hex ff)." SYNTAX OCTET STRING (SIZE (3..99)) -- SNMPv2 over IPX snmpIPXDomain OBJECT-IDENTITY STATUS current DESCRIPTION "The SNMPv2 over IPX transport domain. The corresponding transport address is of type SnmpIPXAddress." ::= { snmpDomains 5 } SnmpIPXAddress ::= TEXTUAL-CONVENTION DISPLAY-HINT "4x.1x:1x:1x:1x:1x:1x.2d" STATUS current DESCRIPTION "Represents an IPX address: octets contents encoding 1-4 network-number network-byte order 5-10 physical-address network-byte order 11-12 socket-number network-byte order " SYNTAX OCTET STRING (SIZE (12)) -- for proxy to SNMPv1 (RFC 1157) rfc1157Proxy OBJECT IDENTIFIER ::= { snmpProxys 1 } rfc1157Domain OBJECT-IDENTITY STATUS current DESCRIPTION "The transport domain for SNMPv1 over UDP. The corresponding transport address is of type SnmpUDPAddress." ::= { rfc1157Proxy 1 } -- ::= { rfc1157Proxy 2 } this OID is obsolete END
Erlang/OTP SNMP SNMPv2-TM(7)
All times are GMT -4. The time now is 07:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy