09-25-2018
What operating system are you using?
What shell are you using?
What is the twist? What you have so briefly described seems to have been asked and answered several times before in this forum.
What have you tried and where are you falling short of reaching your goal?
Without a sample pair of input files and a sample of the output you hope to produce from those input files, it is impossible to guess at whether you're working with fixed length fields in binary files, variable length fields separated by whitespace in a text files, unspecified fields in some kind of databases or spreadsheets, etc.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I know this topic has been covered in one form or another, but it hasn't been covered to handle my problem.
I was given a Sparc4 running Solaris 2.5.1
The root password is unknown. This machine has no cdrom drive and it has no floppy drive.
I tried booting into the single user mode, but... (1 Reply)
Discussion started by: xyyz
1 Replies
2. Shell Programming and Scripting
Ok so I have a file which contains 2 columns/fields and I have another file with 2 columns. The files look like:
file1:
1 33
5 345
18 2
45 1
78 31
file2:
1 c1d2t0
2 c1d3t0
3 c1d4t0
4 c1d4t0
5 c2d1t0
6 c2d1t0
7 c2d1t0
8 c2d1t0
9 c2d1t0
10 c2d1t0 (11 Replies)
Discussion started by: Autumn Tree
11 Replies
3. UNIX for Advanced & Expert Users
Hey all,
I am working on a static analysis tool and I wan't to see if it can find bugs in the linux kernel, it uses LLVM framework to analyse the instructions.
Long story short I need to build the kernel with a custom compiler. The compiler will create byte code files where binaries usually... (2 Replies)
Discussion started by: zigga15
2 Replies
4. UNIX for Dummies Questions & Answers
Hello Everyone,
I am using the korn shell.
I was hoping to find a set of commands to count files in a directory.
I am using:
ls /home/name/abc* | wc -l
This command works fine when a file matches abc* (returns only the file count) , however when no file(s) are found I get... (2 Replies)
Discussion started by: robert4732
2 Replies
5. Shell Programming and Scripting
I'm currently trying to write a ksh or csh script that would change the name of a file found in directories and attach to the name an incrementing three digit number.
I know how to write a script that will go:
000, 001, 002, 003, etc
The twist is I need more increments then allowed by a 3... (11 Replies)
Discussion started by: Rust
11 Replies
6. Shell Programming and Scripting
I have file1 and file2
I lookup field3 from file2 in field1 of file1 and if there is a match, output field 2,3,5 from file2.
I now want to add field2 of file1 in the output.
I suspect what I have to do is read the entire line of file1 into a 2 dim array? pls help.
here is my code:
... (9 Replies)
Discussion started by: jack.bauer
9 Replies
7. Shell Programming and Scripting
Hello folks!
Raised a bump on my head trying to figure this one out ;)
I have an xml file which needs to be edited, removing an entire property section in the work. Here's what the target section layout looks like:
<property name="something">
{any number of lines go here}
</property>... (7 Replies)
Discussion started by: LinQ
7 Replies
8. Shell Programming and Scripting
Hi
I can do simple file renaming but this task is slightly more troublesome
Ive got a guy that gives me multiple .pdf filles in a directory named
something like
3412345.pdf
4565465.pdf
8534534.pdf
And he also gives me a html file which is tabled with which shows the filenames above... (2 Replies)
Discussion started by: messiah1
2 Replies
9. Shell Programming and Scripting
Hello,
I have two text files, each with a single column,
file 1:
124152970
123899868
123476854
54258288
123117283
file 2:
124152970
123899868
54258288
123117283
122108330 (5 Replies)
Discussion started by: LMHmedchem
5 Replies
10. Shell Programming and Scripting
Greetings!
I have a quick question which must be deferred to those with greater skill than myself :)
In this situation, I wish to create a list of all the files on an entire partition in descending order sorted by date. I tried numerous switches for ls, and found this line to be the closest... (4 Replies)
Discussion started by: LinQ
4 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