Bash Scripting Search For Records


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash Scripting Search For Records
# 1  
Old 12-01-2009
Bash Scripting Search For Records

Hi,

I urgently need help with an assignment I must complete by tomorrow. I started Bash Scripting yesterday so am a complete newbie. I don't have time to teach myself Bash scripting so please don't redirect me to some tutorials.

The assignment I have to do involves the following:

the aim is to classify cars into 4 separate files and print a summary report.

I must create a file with records:
eg.

ID Number, car, cost, number in stock
0001, ford focus, 5000, 44
0002, ford fiesta, 8000, 22
0003, bmw 320, 12000, 13
0004, vw golf, 30000, 2
0005, honda civic, 7000, 18
0006, bmw 318, 2000, 6
0007, vw passat, 18000, 8
0008.........

I have created this file and called it csv1 for arguments sake.


This is in a directory called $HOME/Cars
I then need to create a script with functions if necessary to split the cars into categories. I then need to determine the category and write 3 records to the appropriate file. the files will need to be created in my program and their names will be:
honda, bmw, vw, ford

these will be stored in my $HOME/Cars directory.

the summary report must display on the screen and contain the info:
- Date
- names of the created files and their pathnames
- total number of cars
- total value of cars

Even if i don't get this perfectly right it's ok i need to create something which will be enough to pass the assignment so coding examples would be good to show that i have an understanding of what im doing!!!????
PLS PLS PLS can someone help. I have 24 hours from now and the clock is ticking.

finally i am not allowed to use sed or awk for this - even though i don't have an idea what they are.....

many thanks in advance........
# 2  
Old 12-01-2009
If it's homework, please post it again in the appropriate forum. Don't forget to include full course details as specified by the extra rules, as the omission of that information can get you banned.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To get older than last 7days records using awk scripting to generate report and send email

Hello All, I have need as below: 1--> I need to get all users(who submit jobs) and their details by using below command: qstat -u \* output of the above command looks line below: job-ID prior name user-id state "submit/start at" queue jclass slots ja-task-ID... (5 Replies)
Discussion started by: VasuKukkapalli
5 Replies

2. Shell Programming and Scripting

Bash of records into file

Hi All, Seeking for your assistance to check if there a file PROS containing on the file1.txt and display the missing PROS file. cat file1.txt 049|0276 230|0457 094|0134 094|1268 080|0445 049|1896 cd home/sysad PROS0490276042017.TXT PROS2300457042017.TXT (9 Replies)
Discussion started by: znesotomayor
9 Replies

3. Shell Programming and Scripting

UNIX scripting for finding duplicates and null records in pk columns

Hi, I have a requirement.for eg: i have a text file with pipe symbol as delimiter(|) with 4 columns a,b,c,d. Here a and b are primary key columns.. i want to process that file to find the duplicates and null values are in primary key columns(a,b) . I want to write the unique records in which... (5 Replies)
Discussion started by: praveenraj.1991
5 Replies

4. Shell Programming and Scripting

Display records between two search strings using sed

I have input file like AAA AAA CCC CCC CCC EEE EEE EEE EEE FFF FFF GGG GGG i was trying to retrieve data between two strings using sed. sed -n /CCC/,/FFF/p input_file Am getting output like CCC CCC CCC (1 Reply)
Discussion started by: NareshN
1 Replies

5. UNIX for Dummies Questions & Answers

how to search for a string within last 15 records

Hi, I have a oracle log file through which I search for a string "ORA-' and if it is present, the job will fail. IF grep('ORA-' $LOGFILE) is used to determine whether the job should fail or not. Log file is populated with help of a sql script Once the job failed few weeks back to... (2 Replies)
Discussion started by: krishnadevanur
2 Replies

6. Shell Programming and Scripting

count and compare no of records in bash shell script.

consider this as a csv file. H,0002,0002,20100218,17.25,P,barani D,1,2,3,4,5,6,7,8,9,10,11 D,1,2,3,4,5,6,7,8,9,10,11 D,1,2,3,4,5,6,7,8,9,10,11 D,1,2,3,4,5,6,7,8,9,10,11 D,1,2,3,4,5,6,7,8,9,10,11 T,5 N i want to read the csv file and count the number of rows that start with D and... (11 Replies)
Discussion started by: barani75
11 Replies

7. UNIX for Dummies Questions & Answers

Bash script to extract spf records

Hello I am trying to generate a script to run on worldwide firewalls. I need the spf block for large sites like google, etc so I can essentially whitelist google sites for users. (Google here is just an example...) Right now I am just testing Bash oneliners to see how I can isolate the... (1 Reply)
Discussion started by: mbubb
1 Replies

8. Shell Programming and Scripting

awk scripting - matching records and summing up time

Hello. I just found out about awk, and it appears that this could handle the problem I'm having right now. I first stumbled on the thread How to extract first and last line of different record from a file, and that problem is almost similar to mine. In my case, an ASCII file will contain the... (0 Replies)
Discussion started by: Gonik
0 Replies

9. Shell Programming and Scripting

Using awk to search variable length records

New to awk and need some help. I have a script that I would like to make more compact. I want to read a file and grab every field, from every record, except the last field. The records are variable length and have varying number of fields. A record will have at least two fields, but can have... (9 Replies)
Discussion started by: synergy_texas
9 Replies

10. UNIX for Dummies Questions & Answers

Select records based on search criteria on first column

Hi All, I need to select only those records having a non zero record in the first column of a comma delimited file. Suppose my input file is having data like: "0","01/08/2005 07:11:15",1,1,"Created",,"01/08/2005" "0","01/08/2005 07:12:40",1,1,"Created",,"01/08/2005"... (2 Replies)
Discussion started by: shashi_kiran_v
2 Replies
Login or Register to Ask a Question