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
LEARN ABOUT DEBIAN
anacrontab
ANACRONTAB(5) Anacron Users' Manual ANACRONTAB(5)
NAME
/etc/anacrontab - configuration file for anacron
DESCRIPTION
The file /etc/anacrontab describes the jobs controlled by anacron(8). Its lines can be of three kinds: job-description lines, environment
assignments, or empty lines.
Job-description lines are of one of these two forms:
period delay job-identifier command
@period_name delay job-identify command
The period is specified in days, the delay in minutes. The job-identifier can contain any non-blank character, except slashes. It is used
to identify the job in Anacron messages, and as the name for the job's timestamp file. The command can be any shell command. The fields
can be separated by blank spaces or tabs. The period_name can only be set to monthly at the present time. This will ensure jobs are only
run once a month, no matter the number of days in this month, or the previous month.
Environment assignment lines are of the form:
VAR = VALUE
Spaces around VAR are removed. No spaces around VALUE are allowed (unless you want them to be part of the value). The assignment takes
effect from the next line to the end of the file, or to the next assignment of the same variable.
Empty lines are either blank lines, line containing white-space only, or lines with white-space followed by a '#' followed by an arbitrary
comment.
You can continue a line onto the next line by ending it with a ''.
SEE ALSO
anacron(8)
The Anacron README file.
AUTHOR
Itai Tzur <itzur@actcom.co.il>
Currently maintained by Pascal Hakim <pasc@(debian.org|redellipse.net)>.
Pascal Hakim 2004-07-11 ANACRONTAB(5)