script for automatic table filtering


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script for automatic table filtering
# 1  
Old 07-19-2012
script for automatic table filtering

Hello everyone! i I'm trying to write a script that can filter data in a text file.

the source file looks like this

Quote:
upload

500 7021481333 _219402757693 12.07.2012 8:49:06
300,20 7014977234 _219402760235 12.07.2012 8:55:47
200 7756808289 _219402762183 12.07.2012 9:00:51
250 7756520164 _219402762736 12.07.2012 9:02:13

remove 13,07,12 -1 remove 13,07,12

219502312010_ 1300 77024486668 2 500 77013018911 _219582735923 13.07.2012 1:39:06
219502346959_ 400 77025379729 2 600 77028475253 _219582738600 13.07.2012 10:38:00
219502496629_ 300 77013786984 2 760 77024417080 _219588544699 13.07.2012 16:55:16
219502549957_ 440,40 77754584939 2
219502648140_ 500 77024668698 2 14,07,12
219502750647_ 350 77025930602 2 100 77029022189 _219682757249 14.07.2012 11:37:39
219502845399_ 600 77014767138 2
219502895273_ 340 77016857922 2
219502312708_ 300 77021293737 2 15,07,12
219502467265_ 400 77018327544 2 500 77014679513 _219788548713 15.07.2012 1:09:01
219502695601_ 500 77016116993 2 250 77026221577 _219788548716 15.07.2012 1:17:13


77014334033 170 2
77013645949 470 2
77018123706 970 2
77022574546 470 2
77012541665 470 2
77013255542 370 2
77025557979 570 2
77021218700 370 2
77753808879 200 2
the result file should look like this

Quote:



500 7021481333
300.20 7014977234
200 7756808289
250 7756520164



1300 77024486668
400 77025379729
300 77013786984
440.40 77754584939
500 77024668698
350 77025930602
600 77014767138
340 77016857922
300 77021293737
400 77018327544
500 77016116993




500 77013018915
600 77028475253
760 77024417080
100 77029022189
500 77014679513
250 77026221577


170 77014334033
470 77013645949
970 77018123706
470 77022574546
470 77012541665
370 77013255542
570 77025557979
370 77021218700
200 77753808879
As you can see mostly i need to delete fields like _219402757693 and date - time 12.07.2012 8:49:06

i know that it's possible to filter text with awk or cut. but the problem is that:

  1. mobile number and amount are in different columns in each block of tables which are much bigger that this sample.
  2. number and amount in some tables are amount and number
  3. amount can be a number from 3 (300) to 7 symbols (3000.00)
  4. some numbers 7XXXXXXXXXX (11 digit format) some are 7XXXXXXXXX (10 digit format) but result should be 11 digit format
  5. commas need to be replaced with dots. (found how to do it with sed)
I was googling for about a week and reading about awk, sed and other text processing/editing commands, but didn't find solution which will work



My main problem is to filter out fields like _219402757693 and date - time 12.07.2012 8:49:06


HELP ME PLEEEEEEEEEEEEAAAASE!!!!!!SmilieSmilieSmilie

Thank you!!!!Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automatic scp Script

I need a script to automatically scp the latest files on DIR1,DIR2 and DIR3 from Source to destination server at same place(DIR1,DIR2 and DIR3) . Further details are: Source Server (192.168.1.5) DIR1 DIR2 DIR3 Destination Server (192.168.1.10) DIR1 DIR2 DIR3 (7 Replies)
Discussion started by: refra
7 Replies

2. Shell Programming and Scripting

Filtering duplicates based on lookup table and rules

please help solving the following. I have access to redhat linux cluster having 32gigs of ram. I have duplicate ids for variable names, in the file 1,2 are duplicates;3,4 and 5 are duplicates;6 and 7 are duplicates. My objective is to use only the first occurrence of these duplicates. Lookup... (4 Replies)
Discussion started by: ritakadm
4 Replies

3. Shell Programming and Scripting

Automatic script trigger

Hi, I'm looking for a way to solve the following scenario: A shell should automatically trigger / run when a text file is placed or present at a specific location. My idea - to create a cron / anacron for every minute and inside that i will call a temp script. Temp script will move to my... (9 Replies)
Discussion started by: Gautham
9 Replies

4. Web Development

Help on filtering the table in HTML

1. how to get the filter option on table so that user can enter the fields which ever they want to print only according to the need ? 2.how to print the full fledge table if there is no value in the rows of the table but it should print the whole rows and column in proper tabular form? (2 Replies)
Discussion started by: sidhi
2 Replies

5. UNIX for Dummies Questions & Answers

Automatic counter script

Hello, I am having trouble calculating some numbers and I was hoping someone could help me solve this. I have one file with 1 column and what I'm trying to do is add up the lines until a certain value is reach, then jump to where it last finished counting and continue. so for ex: if I... (27 Replies)
Discussion started by: verse123
27 Replies

6. UNIX for Dummies Questions & Answers

Filtering using Shell Script

Hello, I am writing a small script which I want to get the values from several files and output the hits result, i.e. week1.hits includes the following, Mon Feb 4 22:02:35 GMT 2008 Tue Feb 5 23:22:12 GMT 2008 Sat Feb 9 01:56:16 GMT 2008 A sample of my script is this, #!/bin/bash ... (0 Replies)
Discussion started by: nitrous642
0 Replies

7. SCO

Automatic FTP script

We are using SCO OS 5.05 server and we are doing a manual ftp to another SCO OS 5.05 server to backup our database. We are using the Bourne shell. We would like to automate the ftp backup of our database instead of doing it manually. It would be nice to run a script. Also would there be anyway... (4 Replies)
Discussion started by: texastig
4 Replies

8. UNIX for Advanced & Expert Users

Automatic script

Hi, is it possible to automatically run a script (bash) when an event occurs? I mean, let's say that I (or one of my users) plug in a flash memory (USB) ... is it possible to run a script every time I do this action (let's say to log user, date and other infos on a file)? Thanks! Bye... (5 Replies)
Discussion started by: TShirt
5 Replies

9. AIX

automatic new routes in route table.

Hi, IBM Server with AIX 5.2. I have already added a static route for a whole network but everyday some automatic routes to hosts adds up in route table of this server, some of which invalid routes that stops communication of server to that network. If these invalid routes are removed from route... (0 Replies)
Discussion started by: system-admin
0 Replies

10. Shell Programming and Scripting

Automatic login script

Hi, I'm a beginner in unix.As a part of my script i need to remote logon using ssh. my script run as being asked for password and logons only after the user enters the password correctly. But my script stops executing after that as I login to a different server(different shell if i'm right).... (3 Replies)
Discussion started by: dayanand
3 Replies
Login or Register to Ask a Question