Data File Processing Help


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Data File Processing Help
# 1  
Old 03-27-2008
Data File Processing Help

I need to read contents of directory and create a list of data files that match a certain pattern and process by renaming it and calling a existing .ksh script then archiving off to file another directory. Any suggestions or samples u could point me to on using .ksh perl or other to process through the list of data files? What would you recommend to strip off a suffix from a data file?. tia
# 2  
Old 03-27-2008
test message
# 3  
Old 03-27-2008
Question Easier to understand with sample data - input & output

Please supply input files, data and desired results. It is much easier to understand from data rather than describing the situation.

To handle filename issues, do a >man basename
not clear exactly what you are trying to do.
# 4  
Old 03-27-2008
file names:

BTIME_ACTUAL_WORK_HRS_wk_45_to_46.csv
BTIME_ACTUAL_WORK_HRS_wk_46_to_47.csv
...
sample processing:

1) strip off/rename each data file
e.g. BTIME_ACTUAL_WORK_HRS_wk_45_to_46.csv to
BTIME_ACTUAL_WORK_HRS.csv

2) call existing .ksh script (it will reference BTIME_ACTUAL_WORK_HRS.csv) each time

3) move/copy of BTIME_ACTUAL_WORK_HRS_wk_45_to_46.csv moved to /archive directory.

4) process next file

Ensure each file is only processed once
Copy of originally named file is archived
Process only non-zero byte files or wc > 3
Assumes job will be called from scheduler when files are ready/waiting

tia
# 5  
Old 03-27-2008
I would humbly suggest you fix the existing ksh script to accept a file name argument. This is begging for ending up in a situation where you are not sure which file you have processed.

Code:
for f in BTIME_ACTUAL_WORK_HRS_*.csv; do
  cp -f "$f" BTIME_ACTUAL_WORK_HRS.cvs
  horrendous_legacy.ksh --majestic --righteous # FIXME: make it accept name of csv file
  mv "$f" archive/  # assume it's not really /archive/
done

Hate to break this to you, but error handling left as an important exercise.

Last edited by era; 03-27-2008 at 05:42 PM.. Reason: Double quotes around file name variable, just to be a model citizen
# 6  
Old 03-27-2008
I agree but the existing .ksh calls an Informatica process that references a specific flat file for a source. It doesn't allow a dynamic flat file source name so I have to replace the existing one it reads...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Data Processing

I have below Data *************************************************** ********************BEGINNING-1******************** directive url is : https://coursera-eu.mokar.com/directives/96df29ff-176a-35f7-8b1b-4ce483d15762 Src urls are :... (8 Replies)
Discussion started by: nikhil jain
8 Replies

2. Shell Programming and Scripting

awk processing of variable number of fields data file

Hy! I need to post-process some data files which have variable (and periodic) number of fields. For example, I need to square (data -> data*data) the folowing data file: -5.34281E-28 -3.69822E-29 8.19128E-29 9.55444E-29 8.16494E-29 6.23125E-29 4.42106E-29 2.94592E-29 1.84841E-29 ... (5 Replies)
Discussion started by: radudownload
5 Replies

3. 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

4. Shell Programming and Scripting

Data processing using awk

Hello, I have some bitrate data in a csv which is in an odd format and is difficult to process in Excel when I have thousands of rows. Therefore, I was thinking of doing this in bash and using awk as the primary application except that due to its complication, I'm a little stuck. ... (24 Replies)
Discussion started by: shadyuk
24 Replies

5. UNIX for Dummies Questions & Answers

Genomic data processing

Dear fellow members, I've just joined the forum and am a newbie to shell scripting and programming. I'm stuck on the following problem. I'm working with large scale genomic data and need to do some analyses on it. Essentially it is text processing problem, so please don't mind the scientific... (0 Replies)
Discussion started by: mvaishnav
0 Replies

6. Programming

Data processing

Hello guys! I have some issue in how to processing some data. I have some files with 3 columns. The 1st column is a name of my sample. The 2nd column is a numerical sequence (very big sequence) starting from "1". And the 3rd column is a feature of each line, represented for a number (completely... (2 Replies)
Discussion started by: bfantinatti
2 Replies

7. Shell Programming and Scripting

Help with data processing, maybe awk

I have a file, first 5 columns are very normal, like "1107",106027,71400,"Y","BIOLOGY",, however, the 6th columns, the user can put comments, anything, just any characters, like new line, double quote, single quote, whatever from the keyboard, like"Please load my previous SOM597G course content in... (3 Replies)
Discussion started by: freelong
3 Replies

8. Shell Programming and Scripting

How should i know that the process is still processing data

I have some process . How should i know that the process is still processing data or got hanged even though it is showing that it is running in background I know of a command called truss. how should i use this command and determine 1) process is still processing data 2) process got hanged... (7 Replies)
Discussion started by: ali560045
7 Replies

9. Shell Programming and Scripting

Checking for a control file before processing a data file

Hi All, I am very new to Shell scripting... I got a requirement. I will have few text files(data files) in a particular directory. they will be with .txt extension. With same name, but with a different extension control files also will be there. For example, Sample_20081001.txt is the data... (4 Replies)
Discussion started by: purna.cherukuri
4 Replies

10. UNIX for Advanced & Expert Users

data processing

hi i am having a file of following kind: 20015#67143645#143123#4214 62014#67143148#67143159#456 15432#67143568#00143862#4632 54112#67143752#0067143657#143 54623#67143357#167215#34531 65446#67143785#143598#7456 75642#67143546#156146#845 24464#67143465#172532#6544... (5 Replies)
Discussion started by: rochitsharma
5 Replies
Login or Register to Ask a Question