Sponsored Content
Top Forums Shell Programming and Scripting Replace two blank line with a single blank line Post 302353086 by durden_tyler on Monday 14th of September 2009 12:57:09 PM
Old 09-14-2009
Or using Perl:

Code:
perl -lne 'if (/^$/ and $n==0){$n++; print} elsif(!/^$/){$n=0; print} else{$n++}' filename

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace blank spaces by single tab, and right alignment

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

2. Shell Programming and Scripting

sed: delete regex line and next line if blank

Hi, I want to write a sed script which from batiato: batiato/giubbe: pip_b.2.txt pip_b.3.txt pip_b.3mmm.txt bennato: bennato/peterpan: 123.txt consoli: pip_a.12.txt daniele: (2 Replies)
Discussion started by: one71
2 Replies

3. Shell Programming and Scripting

how to replace a line in file with blank line

Hi I nned cmd to which will help me to replace a line in file with blank line e.g. file1 a b c d e after running cmd I shud get file1 b c d e (5 Replies)
Discussion started by: tarunn.dubeyy
5 Replies

4. Shell Programming and Scripting

deleting blank line and row containing certain words in single sed command

Hi Is it possible to do the following in a single command /usr/xpg4/bin/sed -e '/rows selected/d' /aemu/CALLAUTO/callauto.txt > /aemu/CALLAUTO/callautonew.txt /usr/xpg4/bin/sed -e '/^$/d' /aemu/CALLAUTO/callautonew.txt > /aemu/CALLAUTO/callauto_new.txt exit (1 Reply)
Discussion started by: aemunathan
1 Replies

5. Shell Programming and Scripting

Fill the empty line by adding line before blank line

FIle A "A" 2 aa 34 3 ac 5 cd "B" 3 hu 67 4 fg 5 gy output shud be A"" 2 aa 34 "A" 3 ac 34 "A" 5 cd 34 "B" 3 hu 67 "B" 4 fg 67 "B" 5 gy 67 (6 Replies)
Discussion started by: cdfd123
6 Replies

6. Shell Programming and Scripting

replace blank line number

hlow all i need help how can i replace blank number with awk input.txt 300::|355264313178490 301::|358814003239510 302::|358316038113400 303::|357954002633660 304::|354072040694090 305::|356956015214190 306::|352943020525180 307::|359574033836610 308::|381810990023580 so will be like... (4 Replies)
Discussion started by: zvtral
4 Replies

7. Shell Programming and Scripting

Need help to replace a pattern with a blank line

Need help to replace the line beginning with tcp_sendspace with a blank line. # cat if en0: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN> inet 10.27.53.21 netmask 0xffffff00 broadcast 10.207.52.255 inet... (11 Replies)
Discussion started by: sags007_99
11 Replies

8. Shell Programming and Scripting

String search and print next all lines in one line until blank line

Dear all I want to search special string in file and then print next all line in one line until blank lines come. Help me plz for same. My input file and desire op file is as under. i/p file: A1/EXT "BSCABD1_21233G1" 757 130823 1157 RADIO X-CEIVER ADMINISTRATION BTS EXTERNAL FAULT ... (7 Replies)
Discussion started by: jaydeep_sadaria
7 Replies

9. Shell Programming and Scripting

sed - How to insert line before the first blank line following a token

Hello. I have a config file (/etc/my_config_file) which may content : # # port for HTTP (descriptions, SOAP, media transfer) traffic port=8200 # network interfaces to serve, comma delimited network_interface=eth0 # set this to the directory you want scanned. # * if have multiple... (6 Replies)
Discussion started by: jcdole
6 Replies

10. Shell Programming and Scripting

In a file, replace blank line by the last line not blank above

Dear All, In a CSV file, say that a given column has been extracted. In that column, information is missing (i.e. blank lines appear). I would like to replace the blank lines by the last valid line (not blank) previously read. For example, consider the extract below: 123 234 543 111... (7 Replies)
Discussion started by: bagvian
7 Replies
PMKSYNTAX(5)						      BSD File Formats Manual						      PMKSYNTAX(5)

NAME
PMK Syntax -- PMK files syntax manual DESCRIPTION
This manual page describe the basic syntax used in PMK files such as pmkfile and scanfile DATA TYPES
PMK uses pseudo types like the following: bool The classical boolean type with TRUE and FALSE values. For example: TRUE FALSE identifier An identifier is a string of alphanumerical and underscores characters. For example: REQUIRED a_label underscores_are_nice quoted This means quoted string which can contain a set of characters delimited by quotation marks. For examples: "simple quoted string" "string that contain "quotes" backslashed" "can also contain filenames like pmkfile.scan" list It is one or more of the previous types between brackets. Multiple objects are separated with a comma. Blanks are currently not allowed beside commas, this means that you can find them only in a quoted string of the list. For example: ("only_one_string") ("added a boolean",TRUE) (mixed_list_of,"words","and",TRUE,"quoted strings") BASIC SYNTAX
PMK can contain comments, blank lines and commands. A command has the following format (? character means optional field): <command><?(label)> { <body> } The command and label names can be assimilated to the 'word' type. See DATA TYPES above. The body can contain comment(s) and definition line(s). A commented line start with a '#' character like the following: # this is a comment line A definition line has the following format: <?blank><key name><?blank>=<?blank><key value> The key name is of identifier type. The key value type can be 'bool', 'quoted' or 'list'. The right type will depend on the key name (see further). For example: CHECK_INCLUDE(header_sys_param) { # following options use different uses of blank characters # key value is word type REQUIRED = TRUE # key value is list type DEPEND= ("dep_one",dep_two,"dep_three") # key value is quoted type INCLUDE = "sys/param.h" } SEE ALSO
pmkfile(5), scanfile(5) BSD
November 5, 2005 BSD
All times are GMT -4. The time now is 11:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy