Sponsored Content
Top Forums Shell Programming and Scripting Parsing a file containing special characters Post 302950414 by vgersh99 on Friday 24th of July 2015 10:27:04 AM
Old 07-24-2015
What does make "special characters" so special? Never heard of "special characters".....
what's the desired out based on a sample provided?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to see special characters in a file using vi

Hi, I have a file which has special characters. I can't see them when I "vi" the file. But I am sure there are some special un seen characters. How can I see them? Please help. Thx (6 Replies)
Discussion started by: jingi1234
6 Replies

2. UNIX for Dummies Questions & Answers

Replace Special characters in a file

Hi, I have a data like this in a file, 402003279034002000100147626030003300010000000000002000029000000 ær^M^\MÍW^H I need to replace those special char to some other char like # or $ Is there any ways to do it... I tried commands tr,sed and many but it was not able to replace because... (1 Reply)
Discussion started by: solai
1 Replies

3. Shell Programming and Scripting

Removing special characters in file

I have file special.txt with the following data. <header info> 123$ty5%98&0asd 1@356fgbv78 09*&^5jkns43( ...........some more rows. In my output file, I want to eliminate all the special characters in my file and I want all other data. need some help. (6 Replies)
Discussion started by: srivsn
6 Replies

4. Shell Programming and Scripting

escaping special characters in file name...

dear, I would like to rename files in a dir to another format, so I write a bash shell script to handle it. But my problem now is how to handle files having special characters like spaces, (, ): "a b c (d).doc" It seems that I need to escape those characters before applying the "mv" command.... (1 Reply)
Discussion started by: lau0001
1 Replies

5. UNIX for Dummies Questions & Answers

Parsing special characters between C and XML..

Hi, I am getting problem in parsing special characters(Like &, > or <) in XML. I need to encode my C program and send in report format to another interface which is in XML format. I do not know how to encode these special characters in C program before sending to XML format. Please help !! (1 Reply)
Discussion started by: ronix007
1 Replies

6. Shell Programming and Scripting

Is there anyway to grep any special characters from a file ?

Is there any command or shell script to grep any special character from a file ? I have a huge file containing millions of user names; the requirement is to find names containing special characters. #!/bin/bash for i in `cat username.txt` do #COMMAND to grep special character done ... (3 Replies)
Discussion started by: poga
3 Replies

7. Shell Programming and Scripting

File containing special characters

Hello All, I am facing challenges in order to transfer a file from windows to unix box,the file contains a special character '×' ,now when I am transferring the file from windows to unix that special character converted to something else like 'Ã' ,another thing I have noticed that the hardware is... (1 Reply)
Discussion started by: prarat
1 Replies

8. Shell Programming and Scripting

Parsing special characters from variable commands

Hi, I am fairly new to unix scripting and recently tasked with some reporting scripts. The reporting checks several batch jobs and this is quite iterative. Now I am trying to minimize script effort and maximize reusability as there are only slight nuances in the repetitive tasks. For... (3 Replies)
Discussion started by: joeniks
3 Replies

9. Red Hat

Special control characters in file

Hi Guys, We receive some huge files on to Linux server. Source system use FTP mechanism to transfer these files on our server. Occasionally one record is getting corrupted while transfer, some control characters are injecting into the file. How to fix this issue ? please advice ? Sample... (2 Replies)
Discussion started by: srikanth38
2 Replies

10. UNIX for Dummies Questions & Answers

Naming file with special characters ?

Hi all, I have a problem with file naming in linux. I have to create a file named like 11/22.csv but shell displays error: no such file or dir. Problem is / character in the file name. I searched unix linux naming concepts and it's restricted in OS. Please tell me if there's any other chance? OS... (3 Replies)
Discussion started by: sembii
3 Replies
Perl::Critic::Policy::RegularExpressions::ProhibitEscapeUseraContributPerl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters(3pm)

NAME
Perl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters - Use character classes for literal meta-characters instead of escapes. AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
Ever heard of leaning toothpick syndrome? That comes from writing regular expressions that match on characters that are significant in regular expressions. For example, the expression to match four forward slashes looks like: m//////; Well, this policy doesn't solve that problem (write it as "m{////}" instead!) but solves a related one. As seen above, the escapes make the expression hard to parse visually. One solution is to use character classes. You see, inside of character classes, the only characters that are special are "", "]", "^" and "-", so you don't need to escape the others. So instead of the following loose IPv4 address matcher: m/ d+ . d+ . d+ . d+ /x; You could write: m/ d+ [.] d+ [.] d+ [.] d+ /x; which is certainly more readable, if less recognizable prior the publication of Perl Best Practices. (Of course, you should really use Regexp::Common::net to match IPv4 addresses!) Specifically, this policy forbids backslashes immediately prior to the following characters: { } ( ) . * + ? | # We make special exception for "$" because "/[$]/" turns into "/[5.008006/" for Perl 5.8.6. We also make an exception for "^" because it has special meaning (negation) in a character class. Finally, "[" and "]" are exempt, of course, because they are awkward to represent in character classes. Note that this policy does not forbid unnecessary escaping. So go ahead and (pointlessly) escape "!" characters. CONFIGURATION
This Policy is not configurable except for the standard options. BUGS
Perl treats "m/[#]/x" in unexpected ways. I think it's a bug in Perl itself, but am not 100% sure that I have not simply misunderstood... This part makes sense: "#f" =~ m/[#]f/x; # match "#f" =~ m/[#]a/x; # no match This doesn't: $qr = qr/f/; "#f" =~ m/[#]$qr/x; # no match Neither does this: print qr/[#]$qr/x; # yields '(?x-ism:[#]$qr )' CREDITS
Initial development of this policy was supported by a grant from the Perl Foundation. AUTHOR
Chris Dolan <cdolan@cpan.org> COPYRIGHT
Copyright (c) 2007-2011 Chris Dolan. Many rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module perl v5.14.2 20Perl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters(3pm)
All times are GMT -4. The time now is 10:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy