Perl to perfrom string manipulation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl to perfrom string manipulation
# 1  
Old 09-10-2008
Perl to perfrom string manipulation

Hi,

Please advise me how to perform checking in perl on the following input below.

Quote:
1.txt
````
886913354744,16,32562,466887244817951,MAD,ACT,07/01/2009,1208411978,,Promotion_ID_66
886938498033,5,38691,466884974420702,MAD,ACT,15/12/2008,1066813001,,Promotion_ID_177
886915548148,2,289,4668874449995,MAD,ACT,04/07/2008,1017151725,,Promotion_ID_222
886938414547,3,110491,466884974430111,MAD,ACT,24/12/2008,1069599770,,Promotion_ID_22
The output criteria will be

1. field 1 will begin as 913354744 for each as example

2. field 4 must be unique.

3. field 7 is showing dd/mm/yyyy, but it require checking if unixtime should covert to dd/mm/yyyy

4. field 8 is showing unix timestamp, but it require checking if dd/mm/yyyy should convert to unix timestamp or value 0 should prompt error.
# 2  
Old 09-10-2008
Hi,

Please pay my tuition, and I'll do your homework.
# 3  
Old 09-10-2008
For uniqueness checks, collect values into a hash; die with an error if the hash already contains the value you are about to add.

For time conversion, HomePage - Perl DateTime Wiki and other obvious Google hits should help you get started.
# 4  
Old 09-10-2008
Hi,would you mind to giv few example for to me to have a good start.
TQ
# 5  
Old 09-10-2008
hi redhed,
I shall giv away tuition $$. but just in this short time period, should quite hard to find one. Good that you could. Cheers!
# 6  
Old 09-11-2008
Quote:
Originally Posted by rauphelhunter
1. field 1 will begin as 913354744 for each as example
What does this mean?

Quote:
Originally Posted by rauphelhunter
3. field 7 is showing dd/mm/yyyy, but it require checking if unixtime should covert to dd/mm/yyyy
And this? Do you just mean you want to make sure it is a valid date?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String manipulation.

If a have a variable with a first and last name. and say the variable looks like this... FIRST LAST how could process the variable to look like First .L bash 3.2 (osx) (3 Replies)
Discussion started by: briandanielz
3 Replies

2. Shell Programming and Scripting

Deleting part of a string : string manipulation

i have something like this... echo "teCertificateId" | awk -F'Id' '{ print $1 }' | awk -F'te' '{ print $2 }' Certifica the awk should remove 'te' only if it is present at the start of the string.. anywhere else it should ignore it. expected output is Certificate (7 Replies)
Discussion started by: vivek d r
7 Replies

3. UNIX for Dummies Questions & Answers

Help with String manipulation

Dear All, I have a question. I have files with the following pattern.>S8_SK1.chr01 NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN NNNNNNNNNNNNNNNNNNNCAGCATGCAATAAGGTGACATAGATATACCCACACACCACACCCTAACACTAACCCTAATCTAACCCTGGCCAACCTGTTT... (13 Replies)
Discussion started by: pawannoel
13 Replies

4. Shell Programming and Scripting

String Manipulation

Write a shell program to display the position of the right - most character in a given input string. Example : Input : RAHUL Output : L is in the 5th position also tell me how to count length of string and how to find the position of specific character in left most side. (1 Reply)
Discussion started by: shashwat2691
1 Replies

5. Shell Programming and Scripting

string manipulation

if I have two string variable, how do I add one to anther. like a= "a" b="b" c=$a+$b but that doesn't work. Is there anyway to solve it.http://www.qtl.co.il/img/copy.pnghttp://www.google.com/favicon.icohttp://www.babylon.com/favicon.icohttp://www.morfix.com/favicon.ico (2 Replies)
Discussion started by: programAngel
2 Replies

6. Shell Programming and Scripting

Perl, string manipulation

Hi all, Supposing the following string: XXXXXXXXXXNEAXXXXXX How can I check if this string has the substring NEA? Best regards Chris (3 Replies)
Discussion started by: chriss_58
3 Replies

7. Shell Programming and Scripting

string manipulation

Hi, I have searched this long and hard and don't seem to see another post on this issue. I have two strings each with the same characters but in a different order. String1=”word” String2=”dwor” I want to test them to show their similarity. Unfortunately I can't do a sort so that they will... (9 Replies)
Discussion started by: Cactus Jack
9 Replies

8. Shell Programming and Scripting

String manipulation

Hi There! I have the following block of text in my input file and in order to parse it correctly, i need to have i.e. If a line starts with a number, ignore it else replace it with the number from the previous line until the first ',' So, for example, 15,9:5/12345 ,10:1 ... (5 Replies)
Discussion started by: orno
5 Replies

9. Shell Programming and Scripting

How to perfrom summation for particular delimited field?

Hi, Please help to share your thought about how to perfrom summation for particular delimited field, and output to the particular file based on -rw-r--r-- 1 abc other 3094 Oct 19 09:40 0132019832-ps5_online_cdrm.unl -rw-r--r-- 1 abc other 1588 Oct 19 09:47... (2 Replies)
Discussion started by: rauphelhunter
2 Replies

10. Programming

string manipulation in C

Hi all, i have the following string as input : "<iframe src="http://abcdef.com/asd/aaa/awerftya0480000008ave/direct;wi.120;hi.600/01?page=" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" allowtransparency="true" width="120" height="600"> <script... (1 Reply)
Discussion started by: trinath
1 Replies
Login or Register to Ask a Question