10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi All ,
I am having an input file as stated below
Input file
6 ddk/djhdj/djhdj/Q 10 0.5
dhd/jdjd.djd.nd/QB 01 0.5
hdhd/jd/jd/jdj/Q 10 0.5
512 hd/hdh/gdh/Q 01 0.5
jdjd/jd/ud/j/QB 10 0.5
HD/jsj/djd/Q 01 0.5
71 hdh/jjd/dj/jd/Q 10 0.5
... (5 Replies)
Discussion started by: kshitij
5 Replies
2. Shell Programming and Scripting
input
"A","B","C,D","E","F"
"S","T","U,V","W","X"
"AA","BB","CC,DD","EEEE","FFF"
required output:
"A","B","C,D","C,D","F"
"S", T","U,V","U,V","X"
"AA","BB","CC,DD","CC,DD","FFF"
tried using awk but double quotes not preserving for every field. any help to solve this is much... (5 Replies)
Discussion started by: khblts
5 Replies
3. Shell Programming and Scripting
Hey folks. I wrote a little awk script that summarizes /proc/net/dev info and then pipes it to the nix column command to set up column spacing appropriately.
Here's some example output:
Iface RxMBytes RxPackets RxErrs RxDrop TxMBytes TxPackets TxErrs TxDrop
bond0 9 83830... (3 Replies)
Discussion started by: ryran
3 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I have a very large file which is of the general format:
0 3 4 2 ...
3 2 4 0 ...
0 3 4 2 ...
3 0 4 2 ...
. . . . ...
. . . . ...
I would like to apply a simple awk/sed script to work out whether there are any 2's, 3's and 4's in each column.
The results would look as... (3 Replies)
Discussion started by: kasan0
3 Replies
5. Shell Programming and Scripting
I am using the command ls -lhB --group-directories-first --no-group --file-type --time-style=+%D $@ | sed 's/AlphaLexman/ALM/g' to replace my username with my initials (to keep the width shorter), but if my username is in the filename such asreport_by_AlphaLexman.txtit becomesreport_by_ALM.txt
... (2 Replies)
Discussion started by: AlphaLexman
2 Replies
6. Shell Programming and Scripting
FILE A:
9780743551526,(Abridged)
9780743551779,(Unabridged)
9780743582469,(Abridged)
9780743582483,(Unabridged)
9780743563468,(Abridged)
9780743563475,(Unabridged)
FILE B:
c3saCandyland 9780743518321 "CANDYLAND" "MCBAIN, ED" 2001
c3sbCandyland 9780743518321 ... (7 Replies)
Discussion started by: glev2005
7 Replies
7. Shell Programming and Scripting
336 brtr
256 hello
Output:
brtr
hello
How can i do this with sed,awk or perl? (5 Replies)
Discussion started by: cola
5 Replies
8. Shell Programming and Scripting
I have a text file
Nov 1 LOG_10_000000343.gzip_COMPLETE 2910 server.log.3
Nov 4 LOG_10_000000343.gzip_COMPLETE 2910 server.log.4
Dec 5 LOG_10_000000343.gzip_blah 2910 server.log.5
Jul 6 LOG_10_000000343.gzip_ERROR 2910 server.log.1
I need to convert this to
Nov 1 LOG_10_000000343.gzip... (3 Replies)
Discussion started by: gubbu
3 Replies
9. Shell Programming and Scripting
I have a txt file as follows
Code:
Oct 1 file1 4144
Oct 1 file23 5170
Oct 2 file5 3434
Oct 21 file56 2343
I need to add a new column by marking the right log file from current directory. For example populate like this. Please not in the second columt for "1" it has... (2 Replies)
Discussion started by: gubbu
2 Replies
10. Shell Programming and Scripting
$ cat log.txt
Name Age Sex Lcation nfld alias xsd
CC 25 M XYZ asx KK Y
BB 21 F XAS awe SS N
SD 21 M AQW rty SD A
How can I replace the column with header "Lcation" with the column with header "alias" and delete the "alias" column?
so that the final output will become:
Name Age Sex... (10 Replies)
Discussion started by: jkl_jkl
10 Replies
adjust(1) General Commands Manual adjust(1)
NAME
adjust - simple text formatter
SYNOPSIS
column] tabsize] [files]...
DESCRIPTION
The command is a simple text formatter for filling, centering, left and right justifying, or only right justifying text paragraphs, and is
designed for interactive use. It reads the concatenation of input files (or standard input if none are given) and produces on standard
output a formatted version of its input, with each paragraph formatted separately. If is given as an input filename, reads standard input
at that point (use as an argument to separate from options.)
reads text from input lines as a series of words separated by space characters, tabs, or newlines. Text lines are grouped into paragraphs
separated by blank lines. By default, text is copied directly to the output, subject only to simple filling (see below) with a right mar-
gin of 72, and leading spaces are converted to tabs where possible.
Options
The command recognizes the following command-line options:
Do not convert leading space characters to tabs on output;
(output contains no tabs, even if there were tabs in input).
Center text on each line.
Lines are pre- and post-processed, but no filling is performed.
Justify text.
After filling, insert spaces in each line as needed to right justify it (except in the last line of each paragraph) while
keeping the justified left margin.
After filling text, adjust the indentation of each line for a smooth right
margin (ragged left margin).
Set the right fill margin to the given column number, instead of 72.
Text is filled, and optionally right justified, so that no output line extends beyond this column (if possible). If is
given, the current right margin of the first line of each paragraph is used for that and all subsequent lines in the para-
graph.
By default, text is centered on column 40. With the option sets the middle column of the centering "window", but auto-
sets the right side as before (which then determines the center of the "window").
Set the tab size to other than the default (eight columns).
Only one of the and options is allowed in a single command line.
Details
Before doing anything else to a line of input text, first handles backspaces, rubbing out preceding characters in the usual way. Next, it
ignores all nonprintable characters except tab. It then expands all tabs to spaces.
For simple text filling, the first word of the first line of each paragraph is indented the same amount as in the input line. Each word is
then carried to the output followed by one space. "Words" ending in terminal_character[quote][closing_character] are followed by two spa-
ces, where terminal_character is any of or quote is a single closing quote or double-quote character (), and close is any of or Here are
some examples:
does not place two spaces after a pair of single closing quotes following a terminal_character).
starts a new output line whenever adding a word (other than the first one) to the current line would exceed the right margin.
understands indented first lines of paragraphs (such as this one) when filling. The second and subsequent lines of each paragraph are
indented the same amount as the second line of the input paragraph if there is a second line, else the same as the first line.
also has a rudimentary understanding of tagged paragraphs
(such as this one) when filling. If the second line of a paragraph is indented more than the first, and the first line has a
word beginning at the same indentation as the second line, the input column position of the tag word or words (prior to the one
matching the second line indentation) is preserved.
Tag words are passed through without change of column position, even if they extend beyond the right margin. The rest of the line is
filled or right justified from the position of the first nontag word.
When is given, uses an intelligent algorithm to insert spaces in output lines where they are most needed, until the lines extend to the
right margin. First, all one space word separators are examined. One space is added to each separator, starting with the one having the
most letters between it and the preceding and following separators, until the modified line reaches the right margin. If all one space
separators are increased to two spaces and more spaces must be inserted, the algorithm is repeated with two space separators, and so on.
Output line indentation is held to one less than the right margin. If a single word is larger than the line size (right margin minus
indentation), that word appears on a line by itself, properly indented, and extends beyond the right margin. However, if is used, such
words are still right justified, if possible.
If the current locale defines class names and (see iswctype(3C)), formats the text in accordance with the character classification and mar-
gin settings (see and options).
EXTERNAL INFLUENCES
Environment Variables
provides a default value for the internationalization variables that are unset or null. If is unset or null, the default value of "C" (see
lang(5)) is used. If any of the internationalization variables contains an invalid setting, will behave as if all internationalization
variables are set to "C". See environ(5).
If set to a nonempty string value, overrides the values of all the other internationalization variables.
determines the interpretation of text as single and/or multi-byte characters, the classification of characters as printable, and the char-
acters matched by character class expressions in regular expressions.
determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informa-
tive messages written to standard output.
determines the location of message catalogs for the processing of
International Code Set Support
Single- and multi-byte character code sets are supported.
DIAGNOSTICS
complains to standard error and later returns a nonzero value if any input file cannot be opened (it skips the file). It does the same
(but quits immediately) if the argument to or is out of range, or if the program is improperly invoked.
Input lines longer than are silently split (before tab expansion) or truncated (afterwards). Lines that are too wide to center begin in
column 1 (no leading spaces).
EXAMPLES
This command is useful for filtering text while in vi(1). For example,
reformats the rest of the current paragraph (from the current line down), evening the lines.
The command:
(where denotes control characters) sets up a useful "finger macro". Typing (Ctrl-X) reformats the entire current paragraph.
is a simple way to break text into separate words without whitespace, except for tagged-paragraph tags.
WARNINGS
This program is designed to be simple and fast. It does not recognize backslash to escape whitespace or other characters. It does not
recognize tagged paragraphs where the tag is on a line by itself. It knows that lines end in newline or null, and how to deal with tabs
and backspaces, but it does not do anything special with other characters such as form feed (they are simply ignored). For complex opera-
tions, standard text processors are likely to be more appropriate.
This program could be implemented instead as a set of independent programs, fill, center, and justify (with the option). However, this
would be much less efficient in actual use, especially given the program's special knowledge of tagged paragraphs and last lines of para-
graphs.
AUTHOR
was developed by HP.
SEE ALSO
nroff(1).
adjust(1)