I'm sure this will be an easy question for you experts out there, but I have been searching the forum and working on this for a couple hours now and can't get it right.
I have a very messy data file that I am trying to tidy up - one of the issues is some records are split into multiple lines: ... (4 Replies)
Hi,
I'm trying to remove multiple lines of text based off a series of different words and output it to a new file
The document contains a ton of data but i want to delete any line that has the following
mx1.rr.biz.com or ns2.ri.biz.com
i tried using grep -v filename "mx1.rr.biz.com" >... (3 Replies)
I have a very large file (10,000,000 lines), that contains a sample id and a property of that sample. I have another file that contains around 1,000,000 lines with sample ids that I want to remove from the original file (create a new file without these lines).
I know how to do this in Perl, but it... (9 Replies)
Well here goes:
I tried to write a batch file that adds a specific fixed text to each line of an already existing text file.
for the adding text infront of each line I tried this:
for /F "delims=" %%j in (list.txt) do echo.STARTTEXT\%%j >> list.txt
for adding text after each line I... (0 Replies)
It is very simple to remove a hyphen from a word anywhere in that word using a simple sed command (sed -i 's/-//g' filename), but I am not able to figure out how to do this:
For example,
apple
-orange
tree
pipe-
banana-shake
dupe-
What my output should look like:
apple
orange
tree... (1 Reply)
My file has the entries like below...
/dev/sds
/dev/sdak
/dev/sdbc
/dev/sdbu
I want to make the file like below
echo 1 > /sys/block/sds/device/rescan
echo 1 > /sys/block/sdak/device/rescan
echo 1 > /sys/block/sdbc/device/rescan
echo 1 > /sys/block/sdbu/device/rescan (2 Replies)
Greetings.
I've got a csv file with data along these lines:
Spumoni's Pizza Place, Placemats n Things, Just Lamps
Counterfeit Dollars by Vinnie, Just Shades, Dollar StoreI want to replace the entire comma-delimited field if it matches something ending in "Place" or beginning with "Dollar",... (2 Replies)
Hi,
I have been searching how to do this but I can't seem to find how to do it. Hopefully someone can help.
I have multiplr files, 100's example 12345-zxys.213423.zyz.txt. I want to be able to take all these files and remove the first '12345-' from each of the files. '12345-' these characters... (5 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 OPENDARWIN
fmt
FMT(1) BSD General Commands Manual FMT(1)NAME
fmt -- simple text formatter
SYNOPSIS
fmt [-cmnps] [-d chars] [-l num] [-t num] [goal [maximum] | -width | -w width] [file ...]
DESCRIPTION
The fmt utility 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 10 more than the goal length. Alternatively, a single width parameter can be specified either by prepend-
ing a hyphen to it or by using -w. For example, ``fmt -w 72'', ``fmt -72'', and ``fmt 72 72'' all produce identical output. The spacing at
the beginning of the input lines is preserved in the output, as are blank lines and interword spacing. Lines are joined or split only at
white space; that is, words are never joined or hyphenated.
The options are as follows:
-c Center the text, line by line. In this case, most of the other options are ignored; no splitting or joining of lines is done.
-m Try to format mail header lines contained in the input sensibly.
-n Format lines beginning with a '.' (dot) character. Normally, fmt does not fill these lines, for compatibility with nroff(1).
-p Allow indented paragraphs. Without the -p flag, any change in the amount of whitespace at the start of a line results in a new para-
graph being begun.
-s Collapse whitespace inside lines, so that multiple whitespace characters are turned into a single space. (Or, at the end of a sen-
tence, a double space.)
-d chars
Treat the chars (and no others) as sentence-ending characters. By default the sentence-ending characters are full stop ('.'), ques-
tion mark ('?') and exclamation mark ('!'). Remember that some characters may need to be escaped to protect them from your shell.
-l number
Replace multiple spaces with tabs at the start of each output line, if possible. Each number spaces will be replaced with one tab.
The default is 8. If number is 0, spaces are preserved.
-t number
Assume that the input files' tabs assume number spaces per tab stop. The default is 8.
The fmt utility is meant to format mail messages prior to sending, but may also be useful for other simple tasks. For instance, within vis-
ual 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.
The version described herein is a complete rewrite and appeared in FreeBSD 4.4.
AUTHORS
Kurt Shoens
Liz Allen (added goal length concept)
Gareth McCaughan
BUGS
The program was designed to be simple and fast - for more complex operations, the standard text processors are likely to be more appropriate.
When the first line of an indented paragraph is very long (more than about twice the goal length), the indentation in the output can be
wrong.
The fmt utility is not infallible in guessing what lines are mail headers and what lines are not.
BSD June 25, 2000 BSD