big file processeing


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting big file processeing
# 1  
Old 04-12-2003
big file processeing

hi,

i have a very big file that holding data, how could i pick line by line from this file.
the following process can illustrate better:

file
-------------------
123444444 |
122314567 |-----------data
146689000 |

c=123444444 ---------- c is variable

process c ----------- passing c to script (sh,sql....etc)

c=122314567 ---------- c is variable

process c ----------- passing c to script (sh,sql....etc)

c=146689000 ---------- c is variable

process c ----------- passing c to script (sh,sql....etc)


i think u understand what i want to do
please help

thanx in advance
# 2  
Old 04-12-2003
One way to do it in Perl

I'm more of a Perl man, so here it is in perl:
Code:
#!/usr/bin/perl -w

while ($c = <>) {
    #Process $c here!!!
}

exit 0;

put the above code in a file called something like lineExtract.pl, make it executable, then you can do the following to use it:

./lineExtract.pl <big_file_to_process

$c will contain the information one line at a time!
# 3  
Old 04-13-2003
thanx Wintellect ..... how could i represent this with SH
# 4  
Old 04-13-2003
Code:
#!/usr/bin/ksh
exec < datafile
while read c ; do
          somescript  $c
done
exit 0

Whether or not this will work with sh depends on which version of sh. If it has the read statement, it should work.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to convert CR to LF in a big file?

Hello Friends, I have a big file that is transferred to my UNIX system and it seems it has CR as the line delimiter When I run file <filename> <filename>: ASCII text, with CR line terminators How do I convert the file to one with LF as terminators so that my code that runs on UNIX can... (3 Replies)
Discussion started by: mehimadri12
3 Replies

2. Emergency UNIX and Linux Support

Getting VALUE from Big XML File -- That's All

We got data that was supposed to be CSV, but was sent in a huge XML file. I've downloaded xmlstarlet, but I'm darned if I can get it to operate the "sel" feature to look down a path and get any sort of value. I see pieces of what should be paths, but they seem to have extraneous characters, and... (7 Replies)
Discussion started by: gmark99
7 Replies

3. Shell Programming and Scripting

parsing data from a big file using keys from another smaller file

Hi, I have 2 files format of file 1 is: a1 b2 a2 c2 d1 f3 format of file 2 is (tab delimited): a1 1.2 0.5 0.06 0.7 0.9 1 0.023 a3 0.91 0.007 0.12 0.34 0.45 1 0.7 a2 1.05 2.3 0.25 1 0.9 0.3 0.091 b1 1 5.4 0.3 9.2 0.3 0.2 0.1 b2 3 5 7 0.9 1 9 0 1 b3 0.001 1 2.3 4.6 8.9 10 0 1 0... (10 Replies)
Discussion started by: Lucky Ali
10 Replies

4. UNIX for Dummies Questions & Answers

How big is too big a config.log file?

I have a 5000 line config.log file with several "maybe" errors. Any reccomendations on finding solvable problems? (2 Replies)
Discussion started by: NeedLotsofHelp
2 Replies

5. Shell Programming and Scripting

Inserting a column from one file into another big file

Hi I have two files, one is 1.6 GB. I would like to add one extra column of information to the large file at a specific location (after its 2nd column). For example: File 1 has two columns more than 1000 rows like this MM009987 1 File 2 looks like this MM00098 MM00076 3 4 2 4 2... (1 Reply)
Discussion started by: sogi
1 Replies

6. Solaris

wtmpx file is too big

Hi, I am using Sun Solaris 5.9 OS. I have found a file called wtmpx having a size of 5.0 GB. I want to clear this file using :>/var/adm/wtmpx. My query is, would it cause any problem to the running live system. Could anyone suggest the best method to clear the file without causing problem to... (6 Replies)
Discussion started by: Vijayakumarpc
6 Replies

7. Shell Programming and Scripting

bath processeing script

am currently working on a batch processing script and i am stuck I am not very familiar with the korn shell I need to do the following: Process an input file with the following information: SOURCE FILE 533650_MSCIEUROPE_AvgWeight_YTD_EXP.XLS/Daily/test/Ceurope/EuropeFactset/YTD/... (1 Reply)
Discussion started by: chambala5
1 Replies

8. UNIX for Dummies Questions & Answers

How to view a big file(143M big)

1 . Thanks everyone who read the post first. 2 . I have a log file which size is 143M , I can not use vi open it .I can not use xedit open it too. How to view it ? If I want to view 200-300 ,how can I implement it 3 . Thanks (3 Replies)
Discussion started by: chenhao_no1
3 Replies
Login or Register to Ask a Question