Sponsored Content
Full Discussion: sed/awk remove newline
Top Forums Shell Programming and Scripting sed/awk remove newline Post 302444834 by mirfan on Friday 13th of August 2010 02:08:44 AM
Old 08-13-2010
Hello,

I tried this

awk -vORS="" '1' file

but this converting entire lines into single line. I need to do it for only test tables.

inputfile
Code:
INSERT INTO test (column1,column2) VALUES ('column1value','
                  column2value');
UPDATE test2 SET column1='column1value',
column2-'column2value' WHERE column1='column1value';

I require output file as follows:

Code:
INSERT INTO test (column1,column2) VALUES ('column1value','column2value');
UPDATE test2 SET column1='column1value',
column2-'column2value' WHERE column1='column1value';

Thank you.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed ksh remove newline between 2 containers

If we assume that each line between the {} container is an XML document then What I want to remove the newline character from all lines within each container to have one XMDL document per line I wrote a bit of sed after trawling the web: e.g. #!/bin/sed -nf H /}/ { x s/\n//g p... (3 Replies)
Discussion started by: JamesJSC
3 Replies

2. Shell Programming and Scripting

SED: how to remove newline after pattern?

Hi, I have the following XML not well-indented code: <hallo >this is a line </hallo> So I need to remove the newline. This syntax finds what I need to correct, but I don't know how to remove the newline after my pattern: sed 's/<.*$/&/' How can I subtract the newline after my... (1 Reply)
Discussion started by: nico.ben
1 Replies

3. Shell Programming and Scripting

a SED/AWK way to remove everything except...

Hi all, I have a logfile which has lines as following: DOMAIN\username,Deposit,DOMAIN\ServiceAccountName,25/03/2010,00:10,\\SERVER,,,,/Ts=4BAA9BD6,,,10.00,10.03 It's a log of a pcounter print charge system. I need to only have the first part (domain\username) and the second last... (4 Replies)
Discussion started by: necron
4 Replies

4. Shell Programming and Scripting

How to remove lines before and after with awk / sed ?

Hi guys, I need to remove the pattern (ID=180), one line before and four lines after. Thanks. (5 Replies)
Discussion started by: ashimada
5 Replies

5. Shell Programming and Scripting

remove newline between two string with sed command in unix shellscript

I have a file (test.dat) which contains data like this 459|199811047|a |b |shan kar|ooty| 460|199811047|a |bv |gur u|cbe| but I need it like: 459|199811047|a |b |shankar|ooty| 460|199811047|a |b |guru|cbe| While reading the data from this file, I don't want to remove newline from the end of... (4 Replies)
Discussion started by: jcrshankar
4 Replies

6. Shell Programming and Scripting

any savant ? using AWK/SED to remove newline character between two strings : conditional removal

I'd like to remove (do a pattern or precise replacement - this I can handle in SED using Regex ) ---AFTER THE 1ST Occurrence ( i.e. on the 2nd occurrence - from the 2nd to fourth occurance ) of a specific string : type 1 -- After the 1st occurrence of 1 string1 till the 1st occurrence of... (4 Replies)
Discussion started by: sieger007
4 Replies

7. Shell Programming and Scripting

Remove letter from $1 using awk or sed

I have a file: 575G /local/mis/SYBDUMP I want to remove the G, K, M or T so I can use $1 in awk or sed to do math. I want to end up with a file containing: 575 /local/mis/SYBDUMP It should not matter how small or large the numeric numbers are so if 2, 3, 4, or 5 digits etc I want to see... (9 Replies)
Discussion started by: tamvgi
9 Replies

8. Shell Programming and Scripting

sed awk to remove the , in a string

Dear All, Can anyone help to remove the , bewteen "" in a string by using sed or awk? e.g. input : 1,4,5,"abcdef","we,are,here",4,"help hep" output:1,4,5,"abcdef","wearehere",4,"help hep" Thanks, Mimi (5 Replies)
Discussion started by: mimilaw
5 Replies

9. Shell Programming and Scripting

Want to remove / and character using awk or sed

Below i am trying to remove "/" and "r" from the output, so i need output as: hdiskpower3 hdisk0 hdisk1 #inq | grep 5773 | awk '{print $1}' | sed 's/dev//g' | awk -F"/" '{$1=$1}1' .....................................................//rhdiskpower0 //rhdiskpower1 //rhdiskpower2... (3 Replies)
Discussion started by: aix_admin_007
3 Replies

10. Shell Programming and Scripting

sed to remove newline chars based on pattern mis-match

Greetings Experts, I am in AIX; I have a file generated through awk after processing the input files. Now I need to replace or remove the new-line characters on all lines that doesn't have a ; which is the last character on the line. I tried to use sed 's/\n/ /g' After checking through the... (6 Replies)
Discussion started by: chill3chee
6 Replies
ORLite::Mirror(3pm)					User Contributed Perl Documentation				       ORLite::Mirror(3pm)

NAME
ORLite::Mirror - Extend ORLite to support remote SQLite databases SYNOPSIS
# Regular ORLite on a readonly SQLite database use ORLite 'path/mydb.sqlite'; # The equivalent for a remote (optionally compressed) SQLite database use ORLite::Mirror 'http://myserver/path/mydb.sqlite.gz'; # All available additional options specified use ORLite::Mirror { url => 'http://myserver/path/mydb.sqlite.gz', maxage => 3600, show_progress => 1, env_proxy => 1, prune => 1, index => [ 'table1.column1', 'table1.column2', ], }; DESCRIPTION
ORLite provides a readonly ORM API when it loads a readonly SQLite database from your local system. By combining this capability with LWP, ORLite::Mirror goes one step better and allows you to load a SQLite database from any arbitrary URI in readonly form as well. As demonstrated in the synopsis above, you using ORLite::Mirror in the same way, but provide a URL instead of a file name. If the URL explicitly ends with a '.gz' or '.bz2' then ORLite::Mirror will decompress the file before loading it. OPTIONS
ORLite::Mirror adds an extensive set of options to those provided by the underlying ORLite library. url The compulsory "url" parameter should be a string containing the remote location of the SQLite database we will be mirroring. ORLite::Mirror supports downloading the database compressed, and then transparently decompressing the file locally. Compression support is controlled by the extension on the remote database. The extensions ".gz" (for gunzip) and ".bz2" (for bunzip2) are currently supported. maxage The optional "maxage" parameter controls how often ORLite::Mirror should check the remote server to see if the data has been updated. This allows programs using the database to start quickly the majority of the time, but continue to receive automatic updates periodically. The value is the number of integer seconds we should avoid checking the remote server for. The default is 86400 seconds (one 24 hour day). show_progress The optional "show_progress" parameter will be passed through to the underlying LWP::UserAgent that will fetch the remote database file. When set to true, it causes a progress bar to be displayed on the terminal as the database file is downloaded. env_proxy The optional "env_proxy" parameter will be passed through to the underlying LWP::UserAgent that will fetch the remote database file. When set to true, it causes LWP::UserAgent to read the location of a proxy server from the environment. prune The optional "prune" parameter should be used when the surrounding program wants to avoid leaving files on the host system. It causes any files or directories created during the operation of ORLite::Mirror to be deleted on program exit at "END"-time. index One challenge when distributing SQLite database is the quantity of data store on disk to support the indexes on your database. For a moderately indexed database where all primary and foreign key columns have indexes, the amount of data in the indexes can be nearly as large as the data stored for the tables themselves. Because each user of the database module will be interested in different things, the indexes that the original creator chooses to place on the database may not even be used at all and other valuable indexes may not exist at all. To allow sufficiently flexibility, we recommend that SQLite database be distributed without any indexes. This greatly reduces the file size and download time for the database file. The optional "index" parameter should then be used by each different consumer of that module to index just the columns that are of specific interest and will be used in the queries that will be run on the database. The value should be set to an "ARRAY" reference containing a list of column names in "tablename.columnname" form. index => [ 'table1.column1', 'table1.column2', ], SUPPORT
Bugs should be reported via the CPAN bug tracker at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ORLite-Mirror <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ORLite-Mirror> For other issues, contact the author. AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2008 - 2012 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.14.2 2012-02-02 ORLite::Mirror(3pm)
All times are GMT -4. The time now is 09:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy