Sponsored Content
Top Forums Shell Programming and Scripting remove blank lines and merge lines in shell Post 302502616 by dvah on Tuesday 8th of March 2011 12:45:34 PM
Old 03-08-2011
Bug remove blank lines and merge lines in shell

Hi,

I'm not a expert in shell programming, so i've come here to take help from u gurus.

I'm trying to tailor a csv file that i got to make it work for the LOAD FROM command.

I've a datatable csv of the below format -

--in file format
Code:
xx,xx,xx   ,xx , ,  , ,  ,,xx,
xxxx,, ,, xxx,
 
yyy,yy,yy, , , ,yyy,yy,
yyy,yy,,,
 
....

--our file format
Code:
xx,xx,xx   ,xx , ,  , ,  ,,xx,xxxx,, ,, xxx,
yyy,yy,yy, , , ,yyy,yy,yyy,yy,,,

As you can see above, each row of record is seperated by a line gap and also a row record is split into multiple lines. I've to make it in a format as shown below so that i can insert them into my informix db.

So i'm trying acheive two things here
1. Remove blank lines
2. Collide a data row splitted across multiple lines into one(by using the blank line as the end of a record)

Many Thanks!

Last edited by Franklin52; 03-08-2011 at 01:53 PM.. Reason: Please use code tags, thank you
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Remove blank lines

¿How can i remove blank lines between all lines in a long text file? Example WrongFile.txt : Line 1 Line 2 Line 3 CorrectFile.txt : Line 1 Line 2 Line 3 Thanks in advance :confused: (4 Replies)
Discussion started by: osymad
4 Replies

2. UNIX for Dummies Questions & Answers

How to count lines - ignoring blank lines and commented lines

What is the command to count lines in a files, but ignore blank lines and commented lines? I have a file with 4 sections in it, and I want each section to be counted, not including the blank lines and comments... and then totalled at the end. Here is an example of what I would like my... (6 Replies)
Discussion started by: kthatch
6 Replies

3. Shell Programming and Scripting

Remove all blank lines in shell or awk.

Hi there, I want to trim space between lines in unix. I have a file named abc.txt with 2,00,000 lines.But useful are only a few. Please tell me how to delete the blank lines.:o (1 Reply)
Discussion started by: tushar_tus
1 Replies

4. Shell Programming and Scripting

Shell script: Remove blank lines

Hi gurus, I have this file with blank lines in it. How do i remove them in shell? I tried these commands but not working: sed '/^ *$/d' or sed '/^$/d' Anybody has a better idea pls? Also there are lines which starts with a single space, how do we remove the space in those lines?... (3 Replies)
Discussion started by: gholdbhurg
3 Replies

5. Shell Programming and Scripting

remove blank lines

I have joined 2 files. Join command worked fine. but the result showing extra blank lines. I tried to remove blank spaces by using awk (-- -42 RS= ORS="\n\n" file.txt) and sed (sed '/^ *$/d' file.txt)commands but didn't remove any Any suggestions plz:D 123 tab ....... ......tab .......234... (3 Replies)
Discussion started by: repinementer
3 Replies

6. Shell Programming and Scripting

Remove blank lines

I really hope someone can help me with this. I have several php files from a forum that I run, that now for some reason have blank lines after every line. Is there an easy way to make a script that does the following: * If there are consecutive blank lines, delete all of them except one. * If... (9 Replies)
Discussion started by: KidCactus
9 Replies

7. Shell Programming and Scripting

Delete blank lines, if blank lines are more than one using shell

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)
Discussion started by: anil8103
5 Replies

8. Shell Programming and Scripting

How to remove blank lines

Hi, I am facing a problem related to removing blank lines from a text document. Input Error 17-05-2011 11:01:15 VisualSVN Server 2.1 1001 The following information was included with the event: line3 line4 Error 17-05-2011 11:00:25 VisualSVN Server 2.1 ... (13 Replies)
Discussion started by: mayursingru
13 Replies

9. UNIX and Linux Applications

remove all blank lines

When I 'vi' my test file I see some blank lines. However once I do :set list to display hidden characters, I see the empty lines literally like this: ^I$ How do I remove them? I cannot find a regex to match them. (3 Replies)
Discussion started by: alexsuv
3 Replies

10. Shell Programming and Scripting

Remove Blank lines in VI

Hi, Which option is used to remove blank lines in VI (AIX). ? Regards, Siva (6 Replies)
Discussion started by: ksgnathan
6 Replies
WARNQUOTA.CONF(5)						File Formats Manual						 WARNQUOTA.CONF(5)

NAME
warnquota.conf - configuration for warnquota SYNOPSIS
/etc/warnquota.conf DESCRIPTION
The warnquota.conf file stores a configuration for warnquota(8) tool which is used to notify a user or a group who exceeds its disk quota limits. The syntax is an option name followed by an equal sign and the option value. White space characters surrounding the option names and val- ues are allowed. Empty lines or lines starting with a hash sign or a semicolon are ignored. An option value can but does not have to be quoted. The value can span across multiple lines provided each previous line ends with a back- slash. Some option values can contain formatting sequences which will be expanded to their respective values. Following sequences are recognized: %d domain name %h host name %i, %s user or group name %% literal % character | new-line character OPTIONS
CC_BEFORE Send to copy-carbon address only when a user has less than specified grace time left. Value is a number followed by a time unit. Known units are seconds, minutes, hours, and days. Example: 5 days CC_TO An e-mail address to put into copy-carbon (CC:) recipient header. Default value is root. CHARSET Defines character set for sent e-mails. Default value will be current locale character set used when executing warn- quota command, if locale is not either C or POSIX. Otherwise no character set will be specified in the e-mails. FROM Defines From: e-email address. Default value is support@localhost. GROUP_MESSAGE A text sent as an e-mail body if a group exceeds its limits. This option recognizes formatting sequences. GROUP_SIGNATURE A signature text appended to notification for a group. Default value is a general explanation utilizing SUPPORT and PHONE values. This option recognizes formatting sequences. LDAP_BASEDN Base distinguished name for LDAP queries. LDAP_BINDDN Bind distinguished name for LDAP queries. LDAP_BINDPW Bind password for LDAP queries. LDAP_DEFAULT_MAIL_DOMAIN Default e-mail address domain of searched user if given LDAP attribute does not specify any. LDAP_HOST LDAP server name to connect to if LDAP_URI is not defined. LDAP_MAIL A boolean controlling if LDAP has to be used to look up user's e-mail address. Possible values are true and false. Default value is false. LDAP_MAIL_ATTRIBUTE The LDAP attribute which holds user's e-mail address. LDAP_PORT LDAP server port number to connect to if LDAP_URI is not defined. LDAP_SEARCH_ATTRIBUTE The LDAP attribute which holds user's ID to look up. LDAP_URI The URL of LDAP server to use to search user's e-mail addresses. This option takes preference over LDAP_HOST and LDAP_PORT. Example: ldaps://example.com:389/ MESSAGE A beginning of text sent as an e-mail body if a user exceeds his limits. This option recognizes formatting sequences. MAIL_CMD The command to execute to send an e-mail. The e-mail text including all headers is passed to the standard input of the command. Default value is /usr/lib/sendmail -t. MAILDEV The device with disk quotas to exclude from sending notifications if there are exceeded limits. This option should identify the device where mail boxes are stored to prevent from bouncing the warnquota notification by local MDA due to no space for storing new e-mails. Special value any denotes all devices. PHONE The telephone contact to the user support. Default value is (xxx) xxx-xxxx or (yyy) yyy-yyyy. SIGNATURE The end of e-mail body if a user exceeds its limits. Default value is a general explanation utilizing SUPPORT and PHONE values. This option recognizes formatting sequences. SUBJECT The text to put into Subject: header. Default value is Disk Quota usage on system. SUPPORT The contact to the user support. Default value is support@localhost. EXAMPLE
# comment FROM = root@example.com SUPPORT = support@example.com PHONE = 1234 FILES
/etc/warnquota.conf configuration for warnquota(8) SEE ALSO
warnquota(8). WARNQUOTA.CONF(5)
All times are GMT -4. The time now is 01:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy