I have a file with many lines,
then i have following list of lines(line number 5,12,19,5,and 28) i need to replace these lines of a file with another lines as shown below these text
contains special charecter like= (/:;){}[]
Can some one give me a quick solution.
Moderator's Comments:
edit by bakunin: please use [code]...[/code] tags when posting code or output. Thank you.
Hi there
I have a file which has the lines
# Serial number for hostid
EXP_SERIAL_=""
These lines could be anywhere in the file as far as line numbers go, I would like replace these two lines with
# Serial number for hostid $var1
EXP_SERIAL_$var1="$var2"
Is there a quick and simple... (6 Replies)
Hi all,
I am trying to replace a few lines with other lines of all files in a directory which contain those few lines.
say - there are some 10 files in a dir having the same 4 lines as 1.txt at the starting
1.txt
line 1
line 2
line 3
line 4
....................................... (1 Reply)
Hello all,
I need to print all the lines before a specific string and print a custom message 2 lines after that.
So far I have managed to print everything up the string, inclusively, but I can't figure out how to print the 2 lines after that and the custom message.
My code thus far is:... (4 Replies)
Hi.. I'm facing a trouble in replacing two blank lines in a file using shell script...
I used sed to search a line and insert two blank lines after the searchd line using the following sed command.
sed "/data/{G;G;}/" filename . In the file, after data tag, two lines got inserted blank lines..... (4 Replies)
So the tag for this forum says all newbies welcome...
All I want to do is go through my file and find lines which contain a given string of characters then replace these with a blank line. I really tried to find a simple command to do this but failed.
Here's what I did come up with though:
... (2 Replies)
Hi friends,
This is sed & awk type question.
I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example
###start of input text file ####
abc
def
ghi
1
2
3
4
kjld
random... (3 Replies)
Dear all,
Greetings.
I would like to ask for your help to extract lines with specific words in addition 2 lines before and after these lines by using awk or sed.
For example, the input file is:
1 ak1 abc1.0
1 ak2 abc1.0
1 ak3 abc1.0
1 ak4 abc1.0
1 ak5 abc1.1
1 ak6 abc1.1
1 ak7... (7 Replies)
Hi friends,
This is sed & awk type question. It is slightly different from my previous question.
I have a text file which has numbers spread all over the file. I want to sum the series of numbers (but no more than 10 numbers in series) whenever i find it and produce an output file with the... (4 Replies)
Data file example
I look for primary and * to isolate the interesting slot number.
slot=`sed '/^primary$/,/\*/!d' filename | tail -1 | sed s'/*//' | awk '{print $1" "$2}'`
Now I want to get the Touch line for only the associate slot number, in this case, because the asterisk... (2 Replies)
Hi, I need to print lines which are matching with start pattern "SELECT" and END PATTERN ";" and only select the last "select" statement including the ";" .
I have attached sample input file and the desired input should be as:
INPUT FORMAT:
SELECT
ABCD,
DEFGH,
DFGHJ,
JKLMN,
AXCVB,... (5 Replies)
Discussion started by: nani2019
5 Replies
LEARN ABOUT NETBSD
fmt
FMT(1) BSD General Commands Manual FMT(1)NAME
fmt -- simple text formatter
SYNOPSIS
fmt [-Cr] [goal [maximum]] [name ...]
fmt [-Cr] [-g goal] [-m maximum] [name ...]
DESCRIPTION
fmt is a simple text formatter which reads the concatenation of input files (or standard input if none are given) and produces on standard
output a version of its input with lines as close to the goal length as possible without exceeding the maximum. The goal length defaults to
65 and the maximum to 75. The spacing at the beginning of the input lines is preserved in the output, as are blank lines and interword spac-
ing. In non raw mode, lines that look like mail headers or begin with a period are not formatted.
-C instructs fmt to center the text.
-g goal New way to set the goal length.
-m maximum New way to set the maximum length.
-r Raw mode; formats all lines and does not make exceptions for lines that start with a period or look like mail headers.
fmt is meant to format mail messages prior to sending, but may also be useful for other simple tasks. For instance, within visual mode of
the ex(1) editor (e.g., vi(1)) the command
!}fmt
will reformat a paragraph, evening the lines.
SEE ALSO mail(1), nroff(1)HISTORY
The fmt command appeared in 3BSD.
BUGS
The program was designed to be simple and fast - for more complex operations, the standard text processors are likely to be more appropriate.
BSD May 29, 2007 BSD