Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I want to write a csh script to search files "Scan_ddmmyy.csv" placed in a directory. The program should look for EXCLUSIVE flags in the 6th, 7th & 8th fields(0/1- Assume exclusive here for simplicity).The records in Scan*.csv files are to be placed in subdirs A/B/C based on these flags. In case all flags are 0 delete that record. The individual records are thus placed in new files "ScanA/B/C_seq.csv" within the subdirs A/B/C with each file containing a max of 50 records, nd filename with _seq.csv where seq=sequence number of the file.
Please email me with suggestions at: amieyap@hotmail.com Thanks.

Unless you are working under the contraints of a homework assignment, it is a bad idea to write scripts in csh.
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
If you would like to write such a script, please do. If you have difficulty, please post what you have done so far with questions about the trouble spots.

awk is pretty good at this kind of thing, e.g. if testit.dat contains
one,two,three,four
a,b,c,d
banana,fruitcake,piano,hatstandthen
awk -F',' '{print $2,$3}' testit.dat
gives
two four
b d
fruitcake hatstandbtw, if you name the files "scan_yyyymmdd.csv" they can be easily sorted in date order.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |