10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I have a file of a content like this:
abc_bla -def 800
abc_bla -def 802
abc_bla -def 804
abc_bla -def 806
abc_bla -def 808
abc_bla -def 810
abc_bla -def 812
abc_bla -def 814
...
abc_bla -def 898
abc_bla -def 900
abc_bla -def 902
abc_bla -def 904
...
abc_bla -def 990
abc_bla -def... (7 Replies)
Discussion started by: maya3
7 Replies
2. Shell Programming and Scripting
Hi,
I have numerous files which have data in the following format
A|B|123.|Mr.|45.66|33|zz
L|16.|33.45|AC.|45.
I want to remove decimal point only if it is last character in a number.
O/p should be
A|B|123|Mr.|45.66|33|zz
L|16|33.45|AC.|45
I tried this
sed -e 's/.|/|/g'
Problem... (6 Replies)
Discussion started by: wahi80
6 Replies
3. UNIX for Dummies Questions & Answers
I am trying to find files that have lines in them that end in an r. I have been able to locate files by using the following command:
find . -type f -name "*RECORDS"| xargs grep -l r$
However, I now want to find files that don't end in r anywhere. That means that no sentences or lines in... (9 Replies)
Discussion started by: newbie2010
9 Replies
4. Shell Programming and Scripting
Hi, I have multiple large files which consist of the below format:
I am trying to write an awk or sed script to remove all occurrences of the 00 record except the first and remove all of the 80 records except the last one.
Any help would be greatly appreciated. (10 Replies)
Discussion started by: nwalsh88
10 Replies
5. Shell Programming and Scripting
Hello,
I am working with a list that contains a large number of files listed by their absolute path. I am trying to determine a way to delete the file name at the end of each line, therefore leaving just the directory path. For example, I'd like to go from:
/home/something/file... (2 Replies)
Discussion started by: omnivir
2 Replies
6. Shell Programming and Scripting
I have a text file with contents given below:
file:///About/
file:///About/accessibility.html
file:///About/disclaimer.html
file:///About/disclaimer.html#disclaimer
file:///About/glance/contact_info.html
file:///books/
file:///bookshelf/br.fcgi?book=helppubmed&part=pubmedhelp... (6 Replies)
Discussion started by: shoaibjameel123
6 Replies
7. Shell Programming and Scripting
Hi,
I have an ASCII text file where some of the lines are ending with '+' character.
I have to concatenate the next successive line with those lines having the trailing '+' char by removing that char.
The below awk code has some problems to do this task:
awk '{while(sub(/\+$/,"")) {... (12 Replies)
Discussion started by: royalibrahim
12 Replies
8. Shell Programming and Scripting
HI
I'm looking to delete lines ending with .tk from below data file
---------
abc.tk
mgm.tk
dtk
mgmstk
------
I have written below code
----
sed '/.tk *$/d' dat_file.txt > temp.txt
----
But its deleting all the lines ending with tk. I need to delete only the lines ending .tk
my... (5 Replies)
Discussion started by: shekhar_v4
5 Replies
9. Shell Programming and Scripting
I'm trying to search for lines ending with "}" with the following command but am not getting any output.
grep '\}$' myFile.txt
I actually want to negate this (i.e. lines not ending with "}"), but I guess that should be easier once I find the command that finds it? (11 Replies)
Discussion started by: BootComp
11 Replies
10. Solaris
I have a text file with rows of information (it is basically a ls command information(o/p from ls command))
I need to remove the lines ending with a .cnt extension and keep the lines ending with .zip extension, how to accomplish this.
I also only need the date,size and name of the file from every... (2 Replies)
Discussion started by: ramky79
2 Replies
fmt(1) User Commands fmt(1)
NAME
fmt - simple text formatters
SYNOPSIS
fmt [-cs] [-w width | -width] [inputfile...]
DESCRIPTION
fmt is a simple text formatter that fills and joins lines to produce output lines of (up to) the number of characters specified in the -w
width option. The default width is 72. fmt concatenates the inputfiles listed as arguments. If none are given, fmt formats text from the
standard input.
Blank lines are preserved in the output, as is the spacing between words. fmt does not fill nor split lines beginning with a `.' (dot), for
compatibility with
nroff(1). Nor does it fill or split a set of contiguous non-blank lines which is determined to be a mail header, the first line of which
must begin with "From".
Indentation is preserved in the output, and input lines with differing indentation are not joined (unless -c is used).
fmt can also be used as an in-line text filter for vi(1). The vi command:
!}fmt
reformats the text between the cursor location and the end of the paragraph.
OPTIONS
-c Crown margin mode. Preserve the indentation of the first two lines within a paragraph, and align the left margin of
each subsequent line with that of the second line. This is useful for tagged paragraphs.
-s Split lines only. Do not join short lines to form longer ones. This prevents sample lines of code, and other such
formatted text, from being unduly combined.
-w width | -width Fill output lines to up to width columns.
OPERANDS
inputfile Input file.
ENVIRONMENT VARIABLES
See environ(5) for a description of the LC_CTYPE environment variable that affects the execution of fmt.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
nroff(1), vi(1), attributes(5), environ(5)
NOTES
The -width option is acceptable for BSD compatibility, but it may go away in future releases.
SunOS 5.10 9 May 1997 fmt(1)