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)
I am very new to Perl. I am struggling so hard to search a date (such as 10/09/2009, 10-09-2009) from a text file and replace with a string (say DATE) using Perl. Please help me out. Thanks in advance.
Regds
Doren (4 Replies)
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)
I have file t1.log
Contents of t1.log file
Number of records processed:
Number of records rejected:
Error :
xyz ..........
abc ..........
aaa _]
start time :
end time :
Please let me know how i can remove the contents highlighted in red in the t1.log file.
Thanks
Sam (3 Replies)
Hi,
I am not a C programmer. The only C exposure I have is reading and completing the exercises from the C (ANSI C ) Programming Language book:o
At the moment, I am using the UNIX strings command to extract information for a binary file and grepping for a particular string and the value... (3 Replies)
Hi all, the value in the following file is just an example. It could be a different value/network addresses.
Here is my example of initial output in a file name net.txt
Initial Output, net.txt
The goal is to produce the following format which is to convert from CIDR to Netmask... (6 Replies)
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)
Hello Forum.
I have a file called abc.sed with the following commands;
s/1/one/g
s/2/two/g
...
I also have a second file called abc.dat and would like to substitute all occurrences of "1 with one", "2 with two", etc and create a new file called abc_new.dat
sed -f abc.sed abc.dat >... (10 Replies)
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)
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 NETBSD
nl
NL(1) BSD General Commands Manual NL(1)NAME
nl -- line numbering filter
SYNOPSIS
nl [-p] [-b type] [-d delim] [-f type] [-h type] [-i incr] [-l num] [-n format] [-s sep] [-v startnum] [-w width] [file]
DESCRIPTION
The nl utility reads lines from the named file or the standard input if the file argument is omitted, applies a configurable line numbering
filter operation and writes the result to the standard output.
The nl utility treats the text it reads in terms of logical pages. Unless specified otherwise, line numbering is reset at the start of each
logical page. A logical page consists of a header, a body and a footer section; empty sections are valid. Different line numbering options
are independently available for header, body and footer sections.
The starts of logical page sections are signaled by input lines containing nothing but one of the following sequences of delimiter charac-
ters:
Line "Start of"
::: header
:: body
: footer
If the input does not contain any logical page section signaling directives, the text being read is assumed to consist of a single logical
page body.
The following options are available:
-b type
Specify the logical page body lines to be numbered. Recognized type arguments are:
a Number all lines.
t Number only non-empty lines.
n No line numbering.
pexpr Number only those lines that contain the basic regular expression specified by expr.
The default type for logical page body lines is t.
-d delim
Specify the delimiter characters used to indicate the start of a logical page section in the input file. At most two characters may
be specified; if only one character is specified, the first character is replaced and the second character remains unchanged. The
default delim characters are ``:''.
-f type
Specify the same as -b type except for logical page footer lines. The default type for logical page footer lines is n.
-h type
Specify the same as -b type except for logical page header lines. The default type for logical page header lines is n.
-i incr
Specify the increment value used to number logical page lines. The default incr value is 1.
-l num If numbering of all lines is specified for the current logical section using the corresponding -b a, -f a or -h a option, specify the
number of adjacent blank lines to be considered as one. For example, -l 2 results in only the second adjacent blank line being num-
bered. The default num value is 1.
-n format
Specify the line numbering output format. Recognized format arguments are:
ln Left justified.
rn Right justified, leading zeros suppressed.
rz Right justified, leading zeros kept.
The default format is rn.
-p Specify that line numbering should not be restarted at logical page delimiters.
-s sep Specify the characters used in separating the line number and the corresponding text line. The default sep setting is a single tab
character.
-v startnum
Specify the initial value used to number logical page lines; see also the description of the -p option. The default startnum value
is 1.
-w width
Specify the number of characters to be occupied by the line number; in case the width is insufficient to hold the line number, it
will be truncated to its width least significant digits. The default width is 6.
EXIT STATUS
The nl utility exits 0 on success, and >0 if an error occurs.
SEE ALSO pr(1)STANDARDS
The nl utility conforms to X/Open Portability Guide Issue 4, Version 2 (``XPG4.2'') with the exception of not supporting the intermingling of
the file operand with the options, which the standard considers an obsolescent feature to be removed from a further issue.
HISTORY
The nl utility first appeared in AT&T System V Release 2 UNIX.
BSD February 15, 1999 BSD