08-14-2006
how to grep for blank records (space,tab,/n)?
I want to exclude (-v) blank records from a file before analysing it.
I know I can use '^[[:blank:]]$' for spaces and tabs but how do you look for lines that have nothing (/n or line feed) ?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello
I have a file like this...
Name |Sex|Security-Number
abx |F |33787728
cdr |M |823483993
derf |F |
i would like to use awk to delete all records from the file that has a blank in the the 3 rd feild .
the output should be like
... (1 Reply)
Discussion started by: xiamin
1 Replies
2. Shell Programming and Scripting
Folks, I am wondering if anyone solve this problem.
What I want to know is,
1. Delete all white spaces including leading blank space in each line (e.g. line 2), and replace such spaces by single tab except leading blank space
2. Then, align all columns to the right. But, output white space... (1 Reply)
Discussion started by: Jae
1 Replies
3. Shell Programming and Scripting
Dear Member,
OLD Question --> disable-completion not solved
My bash Menu script ping process problem.
If ping still running and users press SCREEN is Blank...
Cant Members help me.. kill signal or others scripting for my case, btw i use Linux..
Thanks,
Rico
My Bash Script :
... (1 Reply)
Discussion started by: carnegiex
1 Replies
4. UNIX for Dummies Questions & Answers
hi!
i'm trying to get grep to do an exact match for the following pattern but..it's not quite working. I'm not too sure where did I get it wrong. any input is appreciated.
echo "$VAR" | grep -q '^test:]name'
if ; then
printf "test name is not found \n"
fi
on... (4 Replies)
Discussion started by: jazzaddict
4 Replies
5. UNIX for Dummies Questions & Answers
Hi everyone.
I am a newbie to Linux stuff. I have this kind of problem which couldn't solve alone. I have a text file with records separated by empty lines like this:
ID: 20
Name: X
Age: 19
ID: 21
Name: Z
ID: 22
Email: xxx@yahoo.com
Name: Y
Age: 19
I want to grep records that... (4 Replies)
Discussion started by: Atrisa
4 Replies
6. Shell Programming and Scripting
Hi All,
Need help to grep blank and copy to file. I have a file in below format
dns1dm06_10,
dns2dm02_04,
dbidub,10000000c9a46d0c
gbpuhci,10000000c948b00a
ibtur001,10000000c9a1ccda
yubkbtp1,10000000c93fec5b
I need to copy to all lines which doesn't have wwn >> no-wwn.txt
1... (2 Replies)
Discussion started by: ranjancom2000
2 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I have a space delimited text file but I only want to change the first space to a tab and keep the rest of the spaces intact. How do I go about doing that? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies
8. Shell Programming and Scripting
Hello,
I have some tab delimited files that may contain blank columns. I would like to delete the blank columns if they exist. There is no clear pattern for when a blank occurs.
I was thinking of using sed to replace instances of double tab with blank,
sed 's/\t\t//g'
All of the examples... (2 Replies)
Discussion started by: LMHmedchem
2 Replies
9. Shell Programming and Scripting
Hi All
Need Help
I have a file with the below format (ABC.TXT) :
®¿¿ABCDHEJJSJJ|XCBJSKK01|M|7348974982790
HDFLJDKJSKJ|KJALKSD02|M|7378439274898
KJHSAJKHHJJ|LJDSAJKK03|F|9898982039999
(cont......)
I need to write a script where it will check for : blank lines (between rows,before... (6 Replies)
Discussion started by: chatwithsaurav
6 Replies
10. Shell Programming and Scripting
hi,
i need to replace a blank tab output in a file to zero.
input file:
2015/08/04 00:00:00 171 730579 27088 <blank> 3823 30273 1621778 ... (6 Replies)
Discussion started by: amyt1234
6 Replies
pr(1) General Commands Manual pr(1)
Name
pr - print files
Syntax
pr [ options ] [ files ]
Description
The command prints the named files on the standard output. If file is designated by a minus sign (-), or if no files are specified the
command assumes standard input. By default, the listing is separated into pages, each headed by the page number, a date and time, and the
name of the file.
By default, columns are of equal width, separated by at least one space. Lines that do not fit are truncated. However, if the -s option is
used, lines are not truncated and columns are separated by the separation character.
If the standard output is associated with a terminal, error messages are withheld until has finished printing.
Options
The following options can be used singly or in combination:
-a Prints multi-column output across the page.
-b Prints blank headers.
-d Double-spaces the output.
-eck Expands input tabs to character positions k+1, 2*k+1, 3*k+1,... n*k+1. If k is 0 or is omitted, tabs are set at every eighth posi-
tion. Tab characters in the input are expanded into the appropriate number of spaces. The default for c (any non-digit character)
is the tab character; therefore, if c is given, it is treated as the input tab character.
-f Uses form-feed character for new pages. The default is to use a sequence of line-feeds. The -f option causes the command to pause
before beginning the first page if the standard output is associated with a terminal.
-h Uses the next argument as the header to be printed instead of the file name.
-ick Replaces white space in output by inserting tabs to character positions k+1, 2*k+1, 3*k+1,...n*k+1. If k is 0 or is omitted, tabs
are set at every eighth position. The default for c (any non-digit character) is the tab character; therefore, if c is given, it
is treated as the input tab character.
+k Begins printing with page k (default is 1).
-k Produces k-column output (default is 1). The -e and -i options are assumed for multi-column output.
-lk Sets the length of a page to k lines. The default is 66 lines.
-m Merges and prints all files simultaneously, one per column (overrides the -k, and -a options).
-nck Numbers lines. The default for k is 20. The number occupies the first k+1 character positions of each column of normal output or
each line of -m output. If c, which is any non-digit character is given, it is appended to the line number to separate it from
whatever follows. The default for c is a tab.
-ok Offsets each line by k character positions (default is 0). The number of character positions per line is the sum of the width and
offset.
-p Pauses before beginning each page if the output is directed to a terminal. The command rings the bell at the terminal and awaits a
carriage return.
-r Suppresses diagnostic reports on failure to open files.
-sc Separates columns by the single character c instead of by the appropriate number of spaces (default for c is a tab).
-t Suppresses the five-line identifying header and the five-line trailer normally supplied for each page. The -t option causes the
command to quit printing after the last line of each file without spacing to the end of the page.
-wk Sets the width of a line to k character positions. The default is 72 for equal-width multi-column output; otherwise there is no
limit.
Examples
Print file1 and file2 as a double-spaced, three-column listing with the heading: file list.
pr -3dh "file list" file1 file2
Write file1 on file2, expanding tabs to columns 10, 19, 28, 37,...:
pr -e9 -t <file1>file2
Files
/dev/tty* to suspend messages
See Also
cat(1)
pr(1)