09-07-2006
awk ' {
if( $0 == "" )
prev_blnk = 1;
else
{
if ( prev_blnk == 1) { print "\n" $0 }
else { print $0; }
prev_blnk = 0;
}
}' file
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I have reached at a specified offset from the start of file. My requirement is that I want to read only those lines, which have the string READ / ALTER / UPDATE. As soon as, none of these literals are found in the subsequent line, I want to stop reading. Is there any feature of grep which... (1 Reply)
Discussion started by: saurabhsinha23
1 Replies
2. Shell Programming and Scripting
Hi
I have a file from which i need to remove the first 4 and the last 2 lines.. i know how to do it with sed but i need to do it in a perl script.. can you please help me how to do that.
Thanks (10 Replies)
Discussion started by: meghana
10 Replies
3. Shell Programming and Scripting
Sample input (line feed indicated by )
---------------
The red fox jumped
over the brown fence of the
red hous
He then went into the
orchard
---------------
Desired Output
---------------
The red fox jumped over the brown fence of the red house
He then went into the orchard (11 Replies)
Discussion started by: dunstonrocks
11 Replies
4. Shell Programming and Scripting
Hi,
I would like to know how to solve one of my problems using expert unix commands.
I have a file with occasional blank lines;
for example;
dertu
frthu
fghtu
frtty
frtgy
frgtui
frgtu
ghrye
frhutp
frjuf
I need to edit the file so that the file looks like this; (10 Replies)
Discussion started by: Lucky Ali
10 Replies
5. Shell Programming and Scripting
Hello,
I am trying to write a script that will count the number of characters for each line in a file and all the lines that have less than 80 characters and that are ending with a period, I want it to insert a blank line after them immediately. But, for whatever reason the condition if ]] is... (3 Replies)
Discussion started by: Pouchie1
3 Replies
6. Shell Programming and Scripting
Hi,
I have a file, say files_list, as below (o/p of ls -R cmd)
$ cat files_list
/remote/dir/path/to/file:
sub-dir1
sub-dir2
sub-dir3
...
/remote/dir/path/to/file/sub-dir1:
remote_file1.csv.tgz
<blank line 1>
/remote/dir/path/to/file/sub-dir2:
remote_file2.csv.tgz
<blank... (3 Replies)
Discussion started by: dips_ag
3 Replies
7. Shell Programming and Scripting
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
8. UNIX for Advanced & Expert Users
Hi Gurus,
Somebody can say me how to delete blank spaces and blank lines in a file unix, please.
Thank you for advanced. (10 Replies)
Discussion started by: systemoper
10 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
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
NET(5) File Formats Manual NET(5)
NAME
net - format of .net files read/written by Magic's netlist editor
DESCRIPTION
Netlist files are read and written by Magic's netlist editor in a very simple ASCII format. The first line contains the characters
`` Netlist File'' (the leading blank is important). After that comes a blank line and then the descriptions of one or more nets. Each
net contains one or more lines, where each line contains a single terminal name. The nets are separated by blank lines. Any line that is
blank or whose first character is blank is considered to be a separator line and the rest of its contents are ignored.
Each terminal name is a path, much like a file path name in Unix. It consists of one or more fields separated by slashes. The last field
in the path is the name of a label in a cell. The other fields (if any), are cell instance identifiers that form a path from the edit cell
down to the label. The first instance identifier must name a subcell of the edit cell, the second must be a subcell of the first, and so
on.
Instance identifiers are unique within their parent cells, so a terminal path selects a unique cell to contain the label. However, the
same label may appear multiple times within its cell. When this occurs, Magic assumes that the identical labels identify electrically
equivalent terminals; it will choose the closest of them when routing to that terminal. Further, after connecting to one of these termi-
nals Magic may take advantage of the internal wiring connecting them together and route through a cell to complete the net's wiring.
An example netlist file follows below. It contains three distinct nets.
----------------------------------------
Netlist File
alu/bit_1/cout
alu/bit_2/cin
regcell[21,2]/output
latch[2]/input
This line starts with a blank, so it's a separator.
opcode_pla/out6
shifter/drivers/shift2
----------------------------------------
SEE ALSO
magic(1)
4th Berkeley Distribution NET(5)