can't figure out a way to delete multiple empty lines but keep single empty lines in a file, file is like this
#cat file
1
2
3
4
5
6
-
What I want is
1
2 (6 Replies)
hi all
I want to get multiple search that are separated by blank line according to first search in text file
eg: egrep 'x|Y|Z' file
in that for each x...it should be seperated by blank line
will u pls help (8 Replies)
Hi Guru's , I have a whole bunch of files in /var/tmp that i need to strip any blank lines from, so ive written the following script to identify the lines (which works perfectly).. but i wanted to know, how can I actually strip the identified lines from the actual source files ??
my... (11 Replies)
Dear All-
Please suggest a single unix command which can append blank line in multiple files.
I need to achieve this using a single unix command and not a script
Please do advice
Regards,
Suresh (2 Replies)
Hi,
Consider a file named "testfile"
The contents of file are as below
first line added for test
second line added for test
third line added for test
fourth line added for test
fifth line added for test (5 Replies)
Hello All ,
I have a file which needs to split based on the blank lines
Name ABC
Address London
Age 32
(4 blank new line)
Name DEF
Address London
Age 30
(4 blank new line)
Name DEF
Address London (8 Replies)
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)
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)
Hi Experts,
In short : Need to split file when field in column 5 is blank and need to generate two file in which column 5 is blank and other in which column 5 has values along with other rows and column data
My issue is i am not able to get header for column from raw file into new file which... (4 Replies)
Discussion started by: as7951
4 Replies
LEARN ABOUT MOJAVE
split
split(n) Tcl Built-In Commands split(n)
__________________________________________________________________________________________________________________________________________________NAME
split - Split a string into a proper Tcl list
SYNOPSIS
split string ?splitChars?
_________________________________________________________________DESCRIPTION
Returns a list created by splitting string at each character that is in the splitChars argument. Each element of the result list will con-
sist of the characters from string that lie between instances of the characters in splitChars. Empty list elements will be generated if
string contains adjacent characters in splitChars, or if the first or last character of string is in splitChars. If splitChars is an empty
string then each character of string becomes a separate element of the result list. SplitChars defaults to the standard white-space char-
acters.
EXAMPLES
Divide up a USENET group name into its hierarchical components:
split "comp.lang.tcl.announce" .
-> comp lang tcl announce
See how the split command splits on every character in splitChars, which can result in information loss if you are not careful:
split "alpha beta gamma" "temp"
-> al {ha b} {} {a ga} {} a
Extract the list words from a string that is not a well-formed list:
split "Example with {unbalanced brace character"
-> Example with {unbalanced brace character
Split a string into its constituent characters
split "Hello world" {}
-> H e l l o { } w o r l d
PARSING RECORD-ORIENTED FILES
Parse a Unix /etc/passwd file, which consists of one entry per line, with each line consisting of a colon-separated list of fields:
## Read the file
set fid [open /etc/passwd]
set content [read $fid]
close $fid
## Split into records on newlines
set records [split $content "
"]
## Iterate over the records
foreach rec $records {
## Split into fields on colons
set fields [split $rec ":"]
## Assign fields to variables and print some out...
lassign $fields
userName password uid grp longName homeDir shell
puts "$longName uses [file tail $shell] for a login shell"
}
SEE ALSO
join(n), list(n), string(n)
KEYWORDS
list, split, string
Tcl split(n)