Sponsored Content
Top Forums Shell Programming and Scripting perl script for file processing Post 302177950 by matrixmadhan on Monday 24th of March 2008 06:24:42 AM
Old 03-24-2008
Minor change but this will make a difference

change the following

Quote:
if((ord($data)>=32)&&(ord($data)<=126)){
print "$data";
}
if(ord($data)==10){
print "\n";}
}
to

Code:
print "$data" if((ord($data)>=32)&&(ord($data)<=126));

print "\n" if(ord($data)==10);

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File processing on perl

Hey everyone ... I wanted to process the contents of a file, as in modify its contents. whats the best way to do it on perl? In more detail I hav to go through the contents of the file, match patterns n then modify the contents of the same file depending on the matching results. Any help is... (2 Replies)
Discussion started by: garric
2 Replies

2. Shell Programming and Scripting

awk, perl Script for processing a single line text file

I need a script to process a huge single line text file: The sample of the text is: "forward_inline_item": "Inline", "options_region_Australia": "Australia", "server_event_err_msg": "There was an error attempting to save", "Token": "Yes", "family": "Family","pwd_login_tab": "Enter Your... (1 Reply)
Discussion started by: hmsadiq
1 Replies

3. Shell Programming and Scripting

Simple Script needed for Processing CSV file perl

I am new to perl, and need a script to pull a CSV file, strip out 2 leading columns, and 2 ending columns, and resave the file in a new location. The file is basic and has less than 10,000 records. Secondly, can I schedule perl scripts to run daily? Can someone provide the basic script to... (1 Reply)
Discussion started by: cobbjob
1 Replies

4. Shell Programming and Scripting

Processing a file in perl

Qspace ABC Queue doCol: true Queue order: fifo Queue setCol: red Queue order: fifo Qspace XYZ Queue getCol: true Queue order: fifo I need to append every line in this file with Qspace & Queue, so that final o/p shall look like this, Qspace: ABC Queue: doCol Qspace: ABC Queue: doCol... (2 Replies)
Discussion started by: deo_kaustubh
2 Replies

5. Shell Programming and Scripting

Perl file processing

I have an input array like : "SVR1" GRP="EVT_BOX06B" SRID=100 MIN=2 "SVR1" GRP="EVT_BOX06B" SRID=200 MIN=1 "SVR2" GRP="ADM_BOX06B" SRID=100 MIN=1 "SVR1" GRP="EVT_BOX88B" SRID=100 MIN=2 "SVR1" GRP="EVT_BOX88B" SRID=200 MIN=1... (4 Replies)
Discussion started by: deo_kaustubh
4 Replies

6. Shell Programming and Scripting

perl script processing error

open(IN,"input_file") or die "Can't open Input file.\n"; while (<IN>) { chomp; $line = $_; if($line != '') { print "\nprocessing $line\n"; $size = 0; $hrid = $line; @project_id_array = null; $size = @project_id_array;... (3 Replies)
Discussion started by: vishwakar
3 Replies

7. Programming

help me with perl script xml processing

Hi everyone, I have Xml files in a folder, I need to extract some attribute values form xml files and store in a hash. My xml file look like this. <?xml version="1.0" encoding="UTF-8"?> <Servicelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"... (0 Replies)
Discussion started by: pavani reddy
0 Replies

8. Shell Programming and Scripting

perl problem in processing excel file

Dear all, I got a perl script to write some data into an excel file using Spreadsheet::ParseExcel::SaveParser. After that I find all formulas in the excel file are gone. Does any body encounter this problem or have any work around? (2 Replies)
Discussion started by: eldonlck
2 Replies

9. Shell Programming and Scripting

Perl script required for processing the data

I have following result.log file (always has 2 lines) which I need to process, cat result.log name.cmd.method,"result","abc","xyz"; name="hello,mine.12345,"&"tree"&" xyz "&" tree "&" xyz", data="way,"&" 1"&"rate-me"&"1"&"rate-me",str="",ret=""; now I need to extract the strings/data as... (4 Replies)
Discussion started by: perlDiva
4 Replies

10. Programming

awk processing / Shell Script Processing to remove columns text file

Hello, I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this : This is the output of ls command : I stored the output in a file filelist 1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies
bytes(3pm)						 Perl Programmers Reference Guide						bytes(3pm)

NAME
bytes - Perl pragma to force byte semantics rather than character semantics NOTICE
This pragma reflects early attempts to incorporate Unicode into perl and has since been superseded. It breaks encapsulation (i.e. it exposes the innards of how the perl executable currently happens to store a string), and use of this module for anything other than debugging purposes is strongly discouraged. If you feel that the functions here within might be useful for your application, this possibly indicates a mismatch between your mental model of Perl Unicode and the current reality. In that case, you may wish to read some of the perl Unicode documentation: perluniintro, perlunitut, perlunifaq and perlunicode. SYNOPSIS
use bytes; ... chr(...); # or bytes::chr ... index(...); # or bytes::index ... length(...); # or bytes::length ... ord(...); # or bytes::ord ... rindex(...); # or bytes::rindex ... substr(...); # or bytes::substr no bytes; DESCRIPTION
The "use bytes" pragma disables character semantics for the rest of the lexical scope in which it appears. "no bytes" can be used to reverse the effect of "use bytes" within the current lexical scope. Perl normally assumes character semantics in the presence of character data (i.e. data that has come from a source that has been marked as being of a particular character encoding). When "use bytes" is in effect, the encoding is temporarily ignored, and each string is treated as a series of bytes. As an example, when Perl sees "$x = chr(400)", it encodes the character in UTF-8 and stores it in $x. Then it is marked as character data, so, for instance, "length $x" returns 1. However, in the scope of the "bytes" pragma, $x is treated as a series of bytes - the bytes that make up the UTF8 encoding - and "length $x" returns 2: $x = chr(400); print "Length is ", length $x, " "; # "Length is 1" printf "Contents are %vd ", $x; # "Contents are 400" { use bytes; # or "require bytes; bytes::length()" print "Length is ", length $x, " "; # "Length is 2" printf "Contents are %vd ", $x; # "Contents are 198.144" } chr(), ord(), substr(), index() and rindex() behave similarly. For more on the implications and differences between character semantics and byte semantics, see perluniintro and perlunicode. LIMITATIONS
bytes::substr() does not work as an lvalue(). SEE ALSO
perluniintro, perlunicode, utf8 perl v5.12.1 2010-04-26 bytes(3pm)
All times are GMT -4. The time now is 07:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy