Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Remove two delimiters, space and double quotes Post 302589417 by pandeesh on Wednesday 11th of January 2012 03:12:52 PM
Old 01-11-2012
This works as expected:
Code:
pandeeswaran@ubuntu:~/training$ cat samp
"#04274DV1!" 414 "104274DV1" 04/30/09 1.25 "BRK CD 104274DV1" "BROKERED CD 1.25 04/30/2009" "RAVE BANK $2,590,000.00" "" ? 01/30/09 0 "t" "n" 0 "" ? 0 ? ? "mo" 30 "h" 
pandeeswaran@ubuntu:~/training$ cat samp|sed -e "s/^\"//g" -e "s/\" /\^_/g" -e "s/ \"/\^_/g" -e "s/\^_$//" -e "s/\"//g"
#04274DV1!^_414^_104274DV1^_04/30/09 1.25^_BRK CD 104274DV1^_BROKERED CD 1.25 04/30/2009^_RAVE BANK $2,590,000.00^_^_? 01/30/09 0^_t^_n^_0^_^_? 0 ? ?^_mo^_30^_h

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Remove double quotes

A Triva question. What is the easy way to remove the double quotes in the file in the following format. "asdfa","fdgh","qwer" tr -d '\"' <filename >newfilename mv newfilename oldfilename This need to be handled in a script. Any better way to do this. Will sed be more effecient? One... (3 Replies)
Discussion started by: deepakwins
3 Replies

2. UNIX for Advanced & Expert Users

How to remove a character which is enclosed in Double quotes

I want to remove the comma which is present within the double quoted string. All other commas which is present outside double quotes should be present. Input : a,b,"cc,dd,ee",f,ii,"jj,kk",mmm output : a,b,"ccddee",f,ii,"jjkk",mmm (3 Replies)
Discussion started by: mohan_tuty
3 Replies

3. Shell Programming and Scripting

How to remove extra double quotes from string in a delimited file??

Hi Unix Gurus.. I am new to Unix. Please help me. The file I am getting is as follows: Input File "2011-07-06 03:53:23","0","I","NOT SET ",,,,"123985","SAW CUT CONCRETE SLAB 20"THICK",,"98.57","","EACH","N" "2011-07-06 03:53:23","0","I","NOT SET ",,,,"204312","ARMAFLEX-1 3/8 X... (2 Replies)
Discussion started by: BICC
2 Replies

4. Shell Programming and Scripting

Replace newline character between a double quotes to a space

Hi Guys, I have a file with content as below aj.txt "Iam allfine" abcdef abcd "all is not well" What I'm trying to say is my data has some new line characters in between quoted text. I must get ride of the newline character that comes in between the quoted text. output must be:... (8 Replies)
Discussion started by: ajahuja
8 Replies

5. Shell Programming and Scripting

Trying to remove double quotes

Hi, I am little new to forum and new on unix side. I have a small issue below: I am reading a file that has 5 columns something like below. col1,col2,col3,col4,col5 Some records are having double quoted values something like below: "value1","value2","value3","value4","value5" I need... (8 Replies)
Discussion started by: Saanvi1
8 Replies

6. Shell Programming and Scripting

Skip the delimiter with in double quotes and count the number of delimiters during data extract

Hi All, I'm stuck-up in finding a way to skip the delimiter which come within double quotes using awk or any other better option. can someone please help me out. Below are the details: Delimited: | Sample data: 742433154|"SYN|THESIS MED CHEM PTY.... (2 Replies)
Discussion started by: BrahmaNaiduA
2 Replies

7. Shell Programming and Scripting

Replace Double quotes within double quotes in a column with space while loading a CSV file

Hi All, I'm unable to load the data using sql loader where there are double quotes within the double quotes As these are optionally enclosed by double quotes. Sample Data : "221100",138.00,"D","0019/1477","44012075","49938","49938/15043000","Television - 22" Refurbished - Airwave","Supply... (6 Replies)
Discussion started by: mlavanya
6 Replies

8. Shell Programming and Scripting

Remove pipe(|) symbol in except the ones which are enclosed in double quotes

I have file with are delimited by pipe(|) symbol, I wanted those to be removed except the ones which are enclosed in double quotes. If your quote file is: |Life is |Beautiful"|"Indeed life |is beautiful too|"|"But unix is fun| is not"|" It should return: Life is Beautiful"|"Indeed life is... (9 Replies)
Discussion started by: Sathyapts
9 Replies

9. Shell Programming and Scripting

Remove Carriage Return (CRLF) within double quotes

How to remove Carriage Return (CRLF) within double quotes in a file. There are multiple CRLFs within double quotes. We are on Ubuntu 14.04.2 LTS. The file that we are importing is a csv file from unix to windows and the file was formatted to unix2dos. Therefore all lines in the file all have... (12 Replies)
Discussion started by: covina
12 Replies

10. UNIX for Beginners Questions & Answers

To remove double quotes from specific columns

Hi, I've a requirement like, in a csv file of 30+ fields where all the columns are having double quotes I need to remove the double quotes from certain fields and certain field should remain as it is. Eg:... (6 Replies)
Discussion started by: Krishnanth S
6 Replies
URI::Find::Delimited(3pm)				User Contributed Perl Documentation				 URI::Find::Delimited(3pm)

NAME
URI::Find::Delimited - Find URIs which may be wrapped in enclosing delimiters. DESCRIPTION
Works like URI::Find, but is prepared for URIs in your text to be wrapped in a pair of delimiters and optionally have a title. This will be useful for processing text that already has some minimal markup in it, like bulletin board posts or wiki text. SYNOPSIS
my $finder = URI::Find::Delimited->new; my $text = "This is a [http://the.earth.li/ titled link]."; $finder->find($text); print $text; METHODS
new my $finder = URI::Find::Delimited->new( callback => &callback, delimiter_re => [ '[', ']' ], ignore_quoted => 1 # defaults to 0 ); All arguments are optional; defaults are provided (see below). Creates a new URI::Find::Delimited object. This object works similarly to a URI::Find object, but as well as just looking for URIs it is also aware of the concept of a wrapped, titled URI. These look something like [http://foo.com/ the foo website] where: * "[" is the opening delimiter * "]" is the closing delimiter * "http://foo.com/" is the URI * "the foo website" is the title * the URI and title are separated by spaces and/or tabs The URI::Find::Delimited object will extract each of these parts separately and pass them to your callback. callback "callback" is a function which is called on each URI found. It is passed five arguments: the opening delimiter (if found), the closing delimiter (if found), the URI, the title (if found), and any whitespace found between the URI and title. The return value of the callback will replace the original URI in the text. If you do not supply your own callback, the object will create a default one which will put your URIs in 'a href' tags using the URI for the target and the title for the link text. If no title is provided for a URI then the URI itself will be used as the title. If the delimiters aren't balanced (eg if the opening one is present but no closing one is found) then the URI is treated as not being wrapped. Note: the default callback will not remove the delimiters from the text. It should be simple enough to write your own callback to remove them, based on the one in the source, if that's what you want. In fact there's an example in this distribution, in "t/delimited.t". delimiter_re The "delimiter_re" parameter is optional. If you do supply it then it should be a ref to an array containing two regexes. It defaults to using single square brackets as the delimiters. Don't use capturing groupings "( )" in your delimiters or things will break. Use non-capturing "(?: )" instead. ignore_quoted If the "ignore_quoted" parameter is supplied and set to a true value, then any URIs immediately preceded with a double-quote char- acter will not be matched, ie your callback will not be executed for them and they'll be treated just as normal text. This is kinda lame but it's in here because I need to be able to ignore things like <img src="http://foo.com/bar.gif"> A better implementation may happen at some point. SEE ALSO
URI::Find. AUTHOR
Kake Pugh (kake@earth.li). COPYRIGHT
Copyright (C) 2003 Kake Pugh. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. CREDITS
Tim Bagot helped me stop faffing over the name, by pointing out that RFC 2396 Appendix E uses "delimited". Dave Hinton helped me fix the regex to make it work for delimited URIs with no title. Nick Cleaton helped me make "ignore_quoted" work. Some of the code was taken from URI::Find. perl v5.8.8 2008-03-01 URI::Find::Delimited(3pm)
All times are GMT -4. The time now is 09:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy