Sponsored Content
Top Forums Shell Programming and Scripting Search a string in a text and replace Post 302825751 by suryanarayana on Tuesday 25th of June 2013 05:49:33 AM
Old 06-25-2013
Search a string in a text and replace

i am having text file below

System will display value URGENT and proceed
System will display value URGENT and proceed
System will display value URGENT and proceed
...............................................................
...............................................................

i want to search a string URGENT and delete from URGENT to end of the line
the output should be


System will display value
System will display value
System will display value
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: Search for string on line then search and replace text

Hi All, I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text. An example of 4 lines in my file is: 1. MatchText_randomNumberOfText moreData ReplaceMe moreData 2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies

2. UNIX for Dummies Questions & Answers

how can search a String in one text file and replace the whole line in another file

i am very new to UNIX plz help me in this scenario i have two text files as below file1.txt name=Rajakumar. Discipline=Electronics and communication. Designation=software Engineer. file2.txt name=Kannan. Discipline=Mechanical. Designation=CADD Design Engineer. ... (6 Replies)
Discussion started by: kkraja
6 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

Search, replace string in file1 with string from (lookup table) file2?

Hello: I have another question. Please consider the following two sample, tab-delimited files: File_1: Abf1 YKL112w Abf1 YAL054c Abf1 YGL234w Ace2 YKL150w Ace2 YNL328c Cup9 YDR441c Cup9 YDR442w Cup9 YEL040w ... File 2: ... ABF1 YKL112W ACE2 YLR131C (9 Replies)
Discussion started by: gstuart
9 Replies

5. Shell Programming and Scripting

awk - replace number of string length from search and replace for a serialized array

Hello, I really would appreciate some help with a bash script for some string manipulation on an SQL dump: I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump. This is quite easy with sed: sed -e... (1 Reply)
Discussion started by: otrotipo
1 Replies

6. UNIX for Dummies Questions & Answers

Search a string in the file and then replace another string after that position

Hi I am looking for a particular string in a file.If the string exists, then I want to replace another string with some other text.Once replaced, search for the same text after that character position in the file. :wall: E.g: Actual File content: Hello Name: Nitin Raj Welcome to Unix... (4 Replies)
Discussion started by: dashing201
4 Replies

7. Shell Programming and Scripting

awk + gsub to search multiple input values & replace with located string + extra text

Hi all. I have the following command that is successfully searching for any one of the strings on all lines of a file and replacing it with the instructed value. cat inputFile | awk '{gsub(/aaa|bbb|ccc|ddd/,"1234")}1' > outputFile This does in fact replace any occurrence of aaa, bbb,... (2 Replies)
Discussion started by: dazhoop
2 Replies

8. Shell Programming and Scripting

Read in search strings from text file, search for string in second text file and output to CSV

Hi guys, I have a text file named file1.txt that is formatted like this: 001 , ID , 20000 002 , Name , Brandon 003 , Phone_Number , 616-234-1999 004 , SSNumber , 234-23-234 005 , Model , Toyota 007 , Engine ,V8 008 , GPS , OFF and I have file2.txt formatted like this: ... (2 Replies)
Discussion started by: An0mander
2 Replies

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

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
ZWRITE(1)						      General Commands Manual							 ZWRITE(1)

NAME
zwrite - write to another user via Zephyr SYNOPSIS
zwrite [ -a ] [ -d ] [ -v ] [ -q ] [ -t ] [ -u ] [ -o ] [ -n ] [ -l ] [ -C ] [ -O opcode ] [ -s signature ] [ -c class ] [ -i instance ] [ -r realm ] [ -f arg ] [ user ... ] [ -m message ] DESCRIPTION
Zwrite sends a message from you to another user through the zephyr(1) notification service. The user must have subscribed to messages of the appropriate class and instance using the zctl(1) program. Zwrite understands the following options. -a Causes zwrite to send the message authenticated, using Kerberos to perform the authentication. This is the default. -d Causes zwrite to send the message unauthenticated. -v Causes zwrite to print what type of message it is sending, and whether or not it was successful. -q Forces zwrite to suppress information about whether or not the message was sent. -t Prevents zwrite from expanding tabs in the message into appropriate spaces. Normally zwrite will expand any tabs it finds into the appropriate number of spaces to maintain separation based on 8-character tab stops. -l Causes zwrite to ignore `.' on a line by itself in the input and only end a typed message when the user types the end-of-file character (usually control-D). When the input is not a terminal, this is the default action. -u Sends an urgent message. This changes the zephyr instance of the message to ``URGENT''. -o Causes zwrite to ignore the Zephyr variables zwrite-class, zwrite-inst, and zwrite-opcode when picking a default class, instance, and opcode. -n prevents zwrite from sending a PING message to verify the recipient is subscribing to messages. By default, zwrite will send a notice to the destination class, instance, and recipient, with opcode ``PING'' before sending the message. If the PING is sent, and the server response indicates there are no recipients subscribed to your message, zwrite exits without sending a mes- sage. When the -n option is used, no PING is sent. -C prepends a "CC:" line to the body of the message indicating the recipients of the message. This is strictly a convenience: the presence of a "CC:" line at the top of a zephyr body does not necessarily indicate that this option was used, or that the mes- sage really was sent to the listed users, and its lack doesn't indicate that the message was not sent to multiple users. -s signature sets the signature to be included in the message. This overrides both the user's name (as found in the password file) and any setting of the Zephyr variable zwrite-signature. signature must be a single argument, hence when using a shell it should be quoted with double quotes. A signature argument of "" leaves the signature in the message empty. -c class Allows a user to specify a different class for the message. This allows a message to be sent to a large group of people with some degree of security. See zephyr(1) and zephyrd(8) for a description of how to restrict access to classes. When this option is specified, the message is sent to recipient "*" unless an additional list of recipients is specified. This argument may not be used in conjunction with the -f option. -i instance Allows a user to specify a different instance than the default. When this option is used, the message is sent to recipient "*" unless an additional list of recipients is specified. This allows a message to be sent to a large group of people (e.g. a development group) just by having the members subscribe to messages of class "MESSAGE", the specified instance, and recipient "*". This argument may not be used in conjunction with the -f option. -r realm Allows a user to specify a different realm for the message, if the server supports interrealm Zephyr. -F format Allows a user to specify a different default format for the message. -O opcode Allows a user to specify a different opcode for the message. Some Zephyr notice display programs may use the opcode to decide how to display a notice. -f arg Allows a user to specify an argument to be interpreted as a filesystem specification. The class is set to FILSRV. he instance is set to arg as modified: If arg contains no colons (`:'), it is assumed to be a host name, and it is converted into an offi- cial host name via gethostbyname(3). If arg contains a colon, the portion preceding the colon is treated as a host name, and the colon and any trailing characters are appended to the offical host name returned by gethostbyname. If the name fails to resolve into an official host name, the instance is set to arg unmodified. This option may not be used in conjunction with the -c or -i option. -m Zwrite sends the remaining arguments on the command line as the message. If the -m option is not specified, the user is prompted for the message to be sent. The message may be terminated by typing ^D or ``.'' on a line by itself. The default class for messages is ``MESSAGE'', the default instance is ``PERSONAL'', andthe default opcode is ``'' (an empty string). These defaults can be overridden by setting the Zephyr variables zwrite-class, zwrite-inst, and zwrite-opcode, respectively. Command-line options can override the defaults. If the class is ``MESSAGE'' and the instance is either ``PERSONAL'' or ``URGENT'', a recipient must be specified. These comparisons are case-sensitive. Unless the -s option is used, the contents of the Zephyr variable zwrite-signature are used to augment the user's username in the message. If zwrite-signature is not set and the -s option is not specified, the user's full name (as specified in the password file) is used instead. BUGS
Tab expansion should really be done by the receiver of the message. The -u option is provided for compatibility with old versions of zwrite and is not necessarily useful for sending messages to users who do not have old subscription files. SEE ALSO
kerberosintro(1), zctl(1), zephyr(1), zwgc(1), zhm(8), zephyrd(8), gethostbyname(3) Project Athena Technical Plan Section E.4.1, `Zephyr Notification Service' FILES
/etc/passwd $ZEPHYR_VARS or $HOME/.zephyr.vars AUTHOR
Robert S. French (MIT-Project Athena) RESTRICTIONS
Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. All Rights Reserved. zephyr(1) specifies the terms and conditions for redistribution. MIT Project Athena October 26, 1989 ZWRITE(1)
All times are GMT -4. The time now is 06:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy