05-22-2003
Re: how to get rid of blank line in a flat text file
Quote:
Originally posted by xfang
Hi, I have a flat text file which contains blank line between each text line. Is there any command to get rid of it?
Thanks for your help
Thanks a lot oombera. I tested it out, it works fine. I have another question, in the text file, if the first character in each line starts with "E", then get rid of the whole line.
Thanks
Thanks, I got the result I want. But I didn't quite understand what ^$ means.
Last edited by xfang; 05-22-2003 at 04:33 PM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi everybody. I need help and I hope someone is willing to help me out here.
My wholesale company is currently moving to new software. The old software is running on a UNIX platform. We need to migrate data from the UNIX system, but our former software provider refuses to assist the data... (5 Replies)
Discussion started by: Wdonero
5 Replies
2. Shell Programming and Scripting
I need your help,
I want to add a text every 2nd line and also a blank line after 3 line
(In the output 2nd line is "changetype: modify" and every 4th line is blank line)
Input file format
dn: abc
orclsourceobjectdn: abcd
dn: bcd
orclsourceobjectdn: bcda
dn: cba
orclsourceobjectdn:... (7 Replies)
Discussion started by: athidhi
7 Replies
3. Shell Programming and Scripting
Hello,
I need to take a random word from a flat text file with words in it seperated by spaces.
The code I am using, always gives me the first word. Can anyone please shed some light on this. Here's my code.
Thanks
echo table roof ceiling jar computer monitor keyboard carpet >... (5 Replies)
Discussion started by: Freakhan
5 Replies
4. Shell Programming and Scripting
Ok,
so i've been having to write to flat files lately and then making my script read information from the flat file and then work off of that.
i dont want to keep doing that because i believe it creates a mess. i like to keep my work all to one script instead of having that one script... (7 Replies)
Discussion started by: SkySmart
7 Replies
5. Shell Programming and Scripting
Hi All,
I have a file.txt which seems like having three lines.
wc -l file.txt
3 file.txt
In fact, once it is open in text editor, this file has four lines where the last line is empty. how can i delete this last empty line of the file.txt? I tried the codes below so far but they... (6 Replies)
Discussion started by: senayasma
6 Replies
6. UNIX for Dummies Questions & Answers
When I use vi to see what's in the file I get this:
int add1(int x) {^M return x + 1;^M}
^Mint subtract1(int x) {^M return x - 1;^M}
^Mint double_it(int x) {^M return x * 2;^M}
^Mint halve_it(int x) {^Mreturn x / 2;^M}
^Mint main() {^M int myint;^M int result;^M ... (2 Replies)
Discussion started by: Nonito84
2 Replies
7. Shell Programming and Scripting
Hi All,
I am creating a text file using perl. The first record I am writing as "$line" and all the other as "\n$line". At the end the file is having N number of lines. I am using this file for MLOAD (Teradata), which is reading N+1 lines in the file and failing.I am not able to find new line... (2 Replies)
Discussion started by: unankix
2 Replies
8. Shell Programming and Scripting
Hi,
Is there a way to find out the line number from where the data starts?
like if the data contains column header, irrespective of the text in the column header we should get the line number from which contains the column header.
I am sorry if I haven't explained the problem clearly.
... (8 Replies)
Discussion started by: kedar_laveti
8 Replies
9. Shell Programming and Scripting
I need to identify the exact text of San Antonio Generator Running in the output my script which lands to a text file. Once SED finds the specific text, I need it to insert one line above the matched text.
Here is what I have so far that isn't working all that well for me. Any help would be... (7 Replies)
Discussion started by: jbrass
7 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 REDHAT
xuniquecontext
XSaveContext(3X11) XLIB FUNCTIONS XSaveContext(3X11)
NAME
XSaveContext, XFindContext, XDeleteContext, XUniqueContext - associative look-up routines
SYNTAX
int XSaveContext(display, rid, context, data)
Display *display;
XID rid;
XContext context;
XPointer data;
int XFindContext(display, rid, context, data_return)
Display *display;
XID rid;
XContext context;
XPointer *data_return;
int XDeleteContext(display, rid, context)
Display *display;
XID rid;
XContext context;
XContext XUniqueContext()
ARGUMENTS
context Specifies the context type to which the data belongs.
data Specifies the data to be associated with the window and type.
data_return
Returns the data.
display Specifies the connection to the X server.
rid Specifies the resource ID with which the data is associated.
DESCRIPTION
If an entry with the specified resource ID and type already exists, XSaveContext overrides it with the specified context. The XSaveContext
function returns a nonzero error code if an error has occurred and zero otherwise. Possible errors are XCNOMEM (out of memory).
Because it is a return value, the data is a pointer. The XFindContext function returns a nonzero error code if an error has occurred and
zero otherwise. Possible errors are XCNOENT (context-not-found).
The XDeleteContext function deletes the entry for the given resource ID and type from the data structure. This function returns the same
error codes that XFindContext returns if called with the same arguments. XDeleteContext does not free the data whose address was saved.
The XUniqueContext function creates a unique context type that may be used in subsequent calls to XSaveContext.
SEE ALSO
Xlib - C Language X Interface
X Version 11 Release 6.6 XSaveContext(3X11)