Sponsored Content
Full Discussion: Another 'VI' question
Top Forums UNIX for Dummies Questions & Answers Another 'VI' question Post 12562 by Jimbo on Thursday 3rd of January 2002 10:04:37 AM
Old 01-03-2002
And here is an awk solution that will strip blank lines, not only null lines but also empty lines containing only white space (spaces and/or tabs). It is selecting all lines where the number of fields (NF) on a line are greater than zero:

awk 'NF>0' in_file > out_file

And one awk solution to strip just the completely null lines:

awk 'length==0' in_file > out_file

And an awk solution to add a blank line after each line:

awk '{print $0;print ""}' in_file > out_file

Or to insert blank lines only where needed, considering that there might already be some blank lines:

awk '{if (NF>0&&prev>0) print "";print $0;prev=NF}' inf > outf

Last edited by Jimbo; 01-04-2002 at 04:23 PM..
Jimbo
 

10 More Discussions You Might Find Interesting

1. Programming

i can't use 'make' in my computer?

I need to compile a file,but 'make' does not work.please tell me how to use it or need which tools? (3 Replies)
Discussion started by: dsun5
3 Replies

2. UNIX for Dummies Questions & Answers

'find' command question

my solaris text talks about the 'find' command... it further goes to talk about an "action" used with the find command. I am completely confused as to what the {} do with the find comand. the explanation is this: "A set of braces, {}, delimits where the file name is passed to the command from... (2 Replies)
Discussion started by: xyyz
2 Replies

3. Shell Programming and Scripting

Clearify what it means under 'WHAT' when hit the 'w'-command

I wonder how I shall read the result below, especially 'what' shown below. The result was shown when I entered 'w'. E.g what is TOP? What is gosh ( what does selmgr mean?)? login@ idle JCPU PCPU what 6:15am 7:04 39 39 TOP 6:34am 6:45 45 45 TOP 6:41am ... (1 Reply)
Discussion started by: Aelgen
1 Replies

4. UNIX for Advanced & Expert Users

Terminal 'Local Echo' lost on Modem Dial-out

Can anybody help me? I am developing a utility for automating message paging to a BT alphanumeric pager. I am using a USR 56K Fax-modem connected to /dev/cuab on a Sun Ultra-10. I am using the UNIX 'tip' utility to connect to the modem and I have configured the modem as follows: Baud Rate:... (2 Replies)
Discussion started by: mybeat
2 Replies

5. UNIX for Dummies Questions & Answers

Further question on 'ifconfig' output

I asked a similar question earlier and got a very good answer but a new doubt came up. This is a few lines of a '/sbin/ifconfig' command on my PC: RX packets:3781025 errors:0 dropped:0 overruns:0 frame:0 TX packets:1941909 errors:0 dropped:0 overruns:0 carrier:0 Does the RX and TX packets... (1 Reply)
Discussion started by: mint1981
1 Replies

6. UNIX for Dummies Questions & Answers

quoting echo 'it's friday'

echo 'it's friday' why appear the > (3 Replies)
Discussion started by: yls177
3 Replies

7. IP Networking

BELKIN 'F5D5020' 16bit PCMCIA - FreeBSD HOWTO

Hey all, I've bought a few bits from Belkin who seem quite happy to support FreeBSD! Last time I bought a UPS from them and it's still going well :D I saw this on their website that the 16bit PCMCIA card was supported under FreeBSD: http://www.belkin.com/network/F5D5020.html I went to my... (0 Replies)
Discussion started by: WIntellect
0 Replies

8. Email Antispam Techniques and Email Filtering

Procmail recipe: blocking 'unsubscribe and opt-out' messages....

Here is a crude procmail recipe that I quickly created (NOT a procmail recipe expert, btw) that has been catching lots of spam (current second after the charset_spam recipe posted earlier): :0B * .*If.you.do.not.wish.to.receive...* more_spam :0B * You.requested.to.receive.this.mailing... (0 Replies)
Discussion started by: Neo
0 Replies

9. UNIX for Advanced & Expert Users

How to remove a file with a leading dash '-' in it's name?

Somehow someone created a file named '-ov' in the root directory. Given the name, the how was probably the result of some cpio command they bozo'ed. I've tried a number of different ways to get rid of it using * and ? wildcards, '\' escape patterns etc.. They all fail with " illegal option --... (3 Replies)
Discussion started by: GSalisbury
3 Replies

10. Shell Programming and Scripting

What are the differences between 'bash' and 'sh'

Hopefully this doesn't come off as too much of a "newbie" question or a flamebait. But I have recently begun working with a Sun Solaris box after having spent the past five years working with RedHat. From what i can tell, thing look fairly similar and the 'man' command is some help. But I've... (7 Replies)
Discussion started by: deckard
7 Replies
strip(1)							   User Commands							  strip(1)

NAME
strip - strip symbol table, debugging and line number information from an object file SYNOPSIS
/usr/ccs/bin/strip [-lVx] file... DESCRIPTION
The strip command removes the symbol table SHT_SYMTAB and its associated string table, debugging information, and line number information from ELF object files. That is, besides the symbol table and associated string table, the following sections are removed: .line .debug* .stab* Once this stripping process has been done, limited symbolic debugging access is available for that file. Therefore, this command is nor- mally run only on production modules that have been debugged and tested. If strip is executed on a common archive file (see ar.h(3HEAD)) in addition to processing the members, strip will remove the archive symbol table. The archive symbol table must be restored by executing the ar(1) command with the -s option before the archive can be linked by the ld(1) command. strip will produce appropriate warning messages when this situation arises. strip is used to reduce the file storage overhead taken by the object file. OPTIONS
The amount of information stripped from the ELF object file can be controlled by using any of the following options: -l Strip line number information only.Does not strip the symbol table or debugging information. -V Prints, on standard error, the version number of strip. -x Does not strip the symbol table. Debugging and line number information may be stripped. OPERANDS
The following operand is supported: file A path name referring to an executable file. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of strip: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. FILES
/tmp/strp* Temporary files ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWbtool | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
ar(1), as(1), ld(1), elf(3ELF), tmpnam(3C), a.out(4), ar.h(3HEAD), attributes(5), environ(5), standards(5) NOTES
The symbol table section will not be removed if it is contained within a segment or if the file is a relocatable object. The line number and debugging sections will not be removed if they are contained within a segment or if their associated relocation section is contained within a segment. SunOS 5.10 15 Jan 2003 strip(1)
All times are GMT -4. The time now is 06:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy