Sponsored Content
Top Forums Shell Programming and Scripting Replace trailing whitespaces with pipe symbol using perl Post 302732579 by Don Cragun on Sunday 18th of November 2012 01:21:33 PM
Old 11-18-2012
What you have shown us is still a single line of input and a single line of output with the 3rd and 6th spaces (which do not appear to be trailing spaces) changed to vertical bars. I still don't understand how to translate your example into a meaningful script. Smilie

Please edit your original post and insert appropriate CODE tags so we can see what you're trying to do.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

remove verticalbar or pipe symbol

hi guys i have 6000 rows column the text in the column has the symbol vertical bar |. i tried some of the commands to remove it but none of the commands are reconzng this symbol. would u plz help to remove this symbol from the text with any kind of unix command u r help would be appreciated ... (9 Replies)
Discussion started by: bogu0001
9 Replies

2. Shell Programming and Scripting

Problem while concating PIPE symbol with a file

Hi Gurus, I had a problem writing a pipe file. Previously i used this code to generate a tab seperated file ABCEF := ABCEF || 'to_char('|| abc_tab(col_num).col_name || ') chr(9) || '; Now i want the o/p as pipe seperated file.I changed the line as below ABCEF := ABCEF ||... (0 Replies)
Discussion started by: pssandeep
0 Replies

3. Shell Programming and Scripting

replace nulls with whitespaces in a file

Hi, i have a file which contains data in fixed length. each row contains data of 10 characters fixed length. The data in the file appears like 4567782882 some times i may recieve dat less than fixed length of 10. in such a case i find nulls appended at the trailing spaces when i do a... (2 Replies)
Discussion started by: meeragiri
2 Replies

4. Shell Programming and Scripting

PERL - Compare 2 strings, excluding whitespaces

I am creating a script to compare definitions and declarations of functions in C code, and report if the arguments are different. So I need to compare the 2 strings (args of both), how can I do that? (2 Replies)
Discussion started by: bojomojo
2 Replies

5. Shell Programming and Scripting

Remove whitespace after pipe symbol but not inside words

I have a file that looks like this: 102| #2 X 1/4-INCH| 30188| EA| FTW| A| NOT SERIAL TRACKING| NOT LOT TRACKING| TRUE| #2 X 1/4-INCH 102| #2 X 1/4-INCH| 30188| EA| VPS| A| NOT SERIAL TRACKING| NOT LOT TRACKING| TRUE| #2 X 1/4-INCH 102| #6 X 1/2"| ... (2 Replies)
Discussion started by: djehresmann
2 Replies

6. Shell Programming and Scripting

Separate letters and replace whitespaces

Input file: aaaa bbb dd. qqq wwww e. Output file: a a a a <s> b b b <s> d d . q q q <s> w w w w <s> e . Can I use sed to do so in one step? (5 Replies)
Discussion started by: Viernes
5 Replies

7. Shell Programming and Scripting

Broken pipe symbol replaced with <A6><A6>

hi, i am copying an xml file from windows to linux server using filezilla&winscp. xml file contains ¦¦ symbols, after copying xml file to server ¦¦ is replaced with <A6><A6>. tried with copying xml files from windows in ascii&binary but no luck. please suggest. thanks (1 Reply)
Discussion started by: Satyak
1 Replies

8. Shell Programming and Scripting

Remove pipe(|) symbol ina file, 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... (1 Reply)
Discussion started by: Sathyapts
1 Replies

9. 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

10. Shell Programming and Scripting

How to replace the first and last character which is pipe symbol in all files within a folder?

with in my files i have the data like this, starting with a pipe and ending the line with a pipe. all i want is to replace the first and last pipe , remove those trying to use following sed command, but it is only showing on the screen the entire data of the file as if it removed, but when i... (4 Replies)
Discussion started by: cplusplus1
4 Replies
RDF::NS(3pm)						User Contributed Perl Documentation					      RDF::NS(3pm)

NAME
RDF::NS - Just use popular RDF namespace prefixes from prefix.cc VERSION
version 20120521 SYNOPSIS
use RDF::NS '20120521'; # check at compile time my $ns = RDF::NS->new('20120521'); # check at runtime $ns->foaf; # http://xmlns.com/foaf/0.1/ $ns->foaf_Person; # http://xmlns.com/foaf/0.1/Person $ns->foaf('Person'); # http://xmlns.com/foaf/0.1/Person $ns->URI('foaf:Person'); # http://xmlns.com/foaf/0.1/Person use RDF::NS; # get rid if typing '$' by defining a constant use constant NS => RDF::NS->new('20111208'); NS->foaf_Person; # http://xmlns.com/foaf/0.1/Person $ns->SPAQRL('foaf'); # PREFIX foaf: <http://xmlns.com/foaf/0.1/> $ns->TTL('foaf'); # @prefix foaf: <http://xmlns.com/foaf/0.1/> . $ns->XMLNS('foaf'); # xmlns:foaf="http://xmlns.com/foaf/0.1/" # get RDF::Trine::Node::Resource instead of strings use RDF::NS::Trine; # requires RDF::Trine $ns = RDF::NS::Trine->new('20120521'); $ns->foaf_Person; # iri('http://xmlns.com/foaf/0.1/Person') # load your own mapping $ns = RDF::NS::LOAD("mapping.txt"); # select particular mappings %map = $ns->SELECT('rdf,dc,foaf'); $uri = $ns->SELECT('foo|bar|doz'); # returns first existing namespace # instances of RDF::NS are just blessed hash references $ns->{'foaf'}; # http://xmlns.com/foaf/0.1/ bless { foaf => 'http://xmlns.com/foaf/0.1/' }, 'RDF::NS'; print (scalar %$ns) . "prefixes "; DESCRIPTION
Hardcoding URI namespaces and prefixes for RDF applications is neither fun nor maintainable. In the end we all use more or less the same prefix definitions, as collected at <http://prefix.cc>. This module includes all these prefixes as defined at specific snapshots in time. These snapshots correspond to version numbers of this module. By selecting particular versions, you make sure that changes at prefix.cc won't affect your scripts. The command line client rdfns is installed automatically with this module: $ rdfns -ttl rdf,foaf @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . This module does not require RDF::Trine, which is recommended nevertheless. You should install at least RDF::NS 0.140. If you prefer RDF::NS to return instances of RDF::Trine::Node::Resource instead of plain strings, use RDF::NS::Trine. The code repository of this module also contains an update script <https://github.com/nichtich/RDF-NS/blob/master/update.pl> to download the current prefix-namespace mappings from <http://prefix.cc>. METHODS
new ( $version [, %options ] ) Create a new namespace mapping with a selected version (mandatory). The special version string "any" can be used to get the newest mapping - actually this is $RDF::NS::VERSION, but you should better select a specific version, as mappings can change, violating backwards compatibility. Supported options include "warn" to enable warnings. LOAD ( $file [, %options ] ) Load namespace mappings from a particular tab-separated file. See NEW for supported options. URI ( $short | "<$URI>" ) Expand a prefixed URI, such as "foaf:Person" or "foaf_Person". Alternatively you can expand prefixed URIs with method calls, such as "$ns->foaf_Person". If you pass an URI wrapped in "<" and ">", it will not be expanded but returned as given. TTL ( prefix[es] ) Returns a Turtle/Notation3 @prefix definition or a list of such definitions in list context. Prefixes can be passed as single arguments or separated by commas, vertical bars, and spaces. SPARQL ( prefix[es] ) Returns a SPARQL PREFIX definition or a list of such definitions in list context. Prefixes can be passed as single arguments or separated by commas, vertical bars, and spaces. XMLNS ( prefix[es] ) Returns an XML namespace declaration or a list of such declarations in list context. Prefixes can be passed as single arguments or separated by commas, vertical bars, and spaces. TXT ( prefix[es] ) Returns a list of tabular-separated prefix-namespace-mappings. BEACON ( prefix[es] ) Returns a list of BEACON format prefix definitions (not including prefixes). SELECT ( prefix[es] ) In list context, returns a sorted list of prefix-namespace pairs, which can be used to assign to a hash. In scalar context, returns the namespace of the first prefix that was found. Prefixes can be passed as single arguments or separated by commas, vertical bars, and spaces. MAP ( $code [, prefix[es] ] ) Internally used to map particular or all prefixes. Prefixes can be selected as single arguments or separated by commas, vertical bars, and spaces. In scalar context, $_ is set to the first existing prefix (if found) and $code is called. In list context, found prefixes are sorted at mapped with $code. GET ( $uri ) This method is used internally to create URIs as return value of the URI method and all lowercase shortcut methods, such as "foaf_Person". By default it just returns $uri unmodified. SEE ALSO
There are several other CPAN modules to deal with IRI namespaces, for instance RDF::Trine::Namespace, RDF::Trine::NamespaceMap, RDF::Prefixes, RDF::Simple::NS, RDF::RDFa::Parser::Profile::PrefixCC, Class::RDF::NS, XML::Namespace, XML::CommonNS etc. AUTHOR
Jakob Voss COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Jakob Voss. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-05-21 RDF::NS(3pm)
All times are GMT -4. The time now is 05:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy