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
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
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
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
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
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
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
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
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
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
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
LEARN ABOUT HPUX
ug_display_width
ug_display_width(3C) ug_display_width(3C)
NAME
ug_display_width() - get current display width for user and group names
SYNOPSIS
DESCRIPTION
The function returns the current display width for user and group names. This value determines how many bytes of a user or group name that
system and conforming applications will display.
On a system with long user and group names enabled, the default display width for the system is set with the command (see lugadmin(1M)).
Users can override the default value by setting the environment variable to an integer value in the range to
Application Usage
System and conforming applications use the return value (current display width) for formatted output as follows:
Long user and group names are not configured on the system.
Display user and group names as per default settings.
Long user and group name are enabled but display user and group names
as per default settings. For user and group names longer (in bytes) than the default allowable length, truncate the
name to the maximum default length and replace the last printed character with a plus sign
If the name is longer (in bytes) than the current display width,
truncate the name to this length (in bytes) and replace the last printed character with a plus sign
EXTERNAL INFLUENCES
Environment Variables
If it is set and long user and group names are enabled,
it overrides the width that is specified by the command for all system and conforming applications that write formatted output.
RETURN VALUE
returns one of the following values:
Long user and group names are not enabled, or an internal error occurred.
Long user and group names are enabled but set to default value.
The current display width for long user and group names.
WARNINGS
It is recommended that you do not modify the file directly. Doing so could cause incorrect behavior.
FILES
If this file is present,
the system is enabled for long user and group names; otherwise, it is not. This file contains the default display width, as set
with the command.
SEE ALSO
lugadmin(1M).
ug_display_width(3C)