Conversion Problem


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Conversion Problem
# 1  
Old 05-23-2005
Conversion Problem

hi,
i am reading a string values from a file.the values are

2000
20000
300
10
5000

now retrieving each value one by one and printing if they are greater than 1000.

i use this statement for the same (in perl script)

if ($_ gt 1000){
print $_
}

but its now prininting all the values.

are the strings form files trated as characters?if so how can convert them to number?any type cast operator?or am i doin anything else wrong?

Thnaks and Regards
Vivek.S
# 2  
Old 05-23-2005
hi i used
if ($e > 20000) and is working

i guess > is fr number comparison and ge , le are all from string...am i right?

ANOTHER QUESTION:

if i use

split(\ \) then it assign it to a and b.

suppose if i want splitting to start from last word what shall i do?

Thanks and Regards
vivek.S
# 3  
Old 05-25-2005
Are you using perl with the -w switch? That gives a lot of useful information.
I suggest you get the book either "Learning Perl" or "Programming Perl."


Also, If you have a completely different question and have searched and read available documentation and still don't understand, post a new thread.
# 4  
Old 05-26-2005
Thanks :-)

can u tell me the author of the books.......so that i cud get one...

thanks and regards
vivek.s
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File conversion problem

To convert file epcdic to ascill format,i am using below code.Getting some junk characters in output file.not sure what the issue is.Please correct if below command is wrong. DD conv=ascii if=filename of =output_filename. (2 Replies)
Discussion started by: srivalli
2 Replies

2. Shell Programming and Scripting

Characterset conversion problem using iconv command

Hi Friends, I am not able to conver character set from UTF-8 to IBM-284 throwing an error "cannot open convertor" . Could you please help me how to get out of this error. Below command is working fine iconv -f ISO8859-15 -t UTF-8 fromfile.txt > tofile.txt But the below command is... (2 Replies)
Discussion started by: sivakumarl
2 Replies

3. UNIX for Advanced & Expert Users

.so to .sl conversion ?

Hi all, I have one libxxx.so file ( which I got from a third party ). We use shared library libxxx.sl . Is there any way to convert the .so file to .sl file ? Thanks in advance - M (3 Replies)
Discussion started by: kanu_kanu
3 Replies

4. Shell Programming and Scripting

Typeset conversion problem from ksh to bash

Hi, typeset -l sgf # all lowercase letters typeset -u SGF # all uppercase letters sgf=$1 SGF=$sgf these lines used in my scripts . It ran fine in ksh but when we convert this to bash it erroring out. I like to know what the use of typeset ?? Thanks & Regards kanagaraj (3 Replies)
Discussion started by: kanagaraj
3 Replies

5. Programming

timestamp conversion problem.

Hi all. I have the following code: #include<stdio.h> #include<time.h> int main() { struct tm tm; time_t time = 1262322000; /*Jan, 01, 2010*/ char temp; int i = 0; while(i < 4) { memset(temp, 0, 128); localtime_r(&time,... (2 Replies)
Discussion started by: adm1n
2 Replies

6. Shell Programming and Scripting

Help in conversion ......

Hi, I have a requirement to capture file time stamp and compare with current system time. I am using HP-AUX K-shell. Below is what i have done Getting current date into myfile2 --------------------------------- date +%Y%m%d%H%M%S > myfile2 20091110132800 Getting the file date into... (5 Replies)
Discussion started by: chinniforu2003
5 Replies

7. Shell Programming and Scripting

Conversion

How to convert Nov 10 14:20 to YYYYMMDDHHMMSS in unix I am using K-shell HP-AUX (1 Reply)
Discussion started by: chinniforu2003
1 Replies

8. UNIX for Dummies Questions & Answers

Conversion problem with date field and formatting.

Hi, My input file contains the record(s) as below with space as FS. 01-01024180 35000 MV010 02/03/09 0306 03060226 03 02-00410330 470000 MV010 02/03/09 0301 03010276 03 1. I need to convert the field 02/03/09 (dd/mm/yy) to yyyymmdd yet retain the Field separator. Using the modified... (2 Replies)
Discussion started by: talk2pawee
2 Replies

9. Shell Programming and Scripting

conversion

hi all i have a file like 151125 25252 2452567 253464576 255 i want this file to be like '151125','25252','2452567','253464576','255' please help thanks (3 Replies)
Discussion started by: infyanurag
3 Replies

10. Shell Programming and Scripting

Problem with File Conversion

Hi All, I am putting the file on UNIX server using "put" remote command. i have one character i.e. Pipeline(|) in the file. When i send this file from other system(Mainframe) to UNIX server, i found that the chracter get changed to Exlametory mark(!). I don't know why?. Can any way tell me... (2 Replies)
Discussion started by: Balkrishna
2 Replies
Login or Register to Ask a Question