|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
awk problems
I have 3 problems I need to figure out. I am just getting started using awk so any examples or solutions would be greatly appreciated.
1. I need to create a total sales report for the year. The data file has commas so I cannot add the numbers easily. How do I remove the commas, add the numbers and then reinsert the commas for the final report? The data file has this format: January<tab><tab>123,456.89 2. I need to find the differences in time between two checkout times. The data file is in this format: 034023<tab>052030 I need to print out a report in this format: hh:mm:ss of column 1<tab>hh:mm:ss of column 2<tab>hh:mm:ss of difference between column 1 and column 2 3. I need to write a script that will validate data: The data file is in this format: login name assword:user ID:Group ID:User Info:Home Directory:Login ShellThe data is validated if - a - the line must have 7 fields b - The first field can be alphnumeric c - The second field should not be empty d - The 3rd and 4th fields should be numeric e - No restriction on the 5th field f - The 6th and 7th fields should start with a "/" The script should create a report and appends any line that violates any of the critera with the reason for violation. I know all of you are very talented with awk and can help me out. I really appreciate it. I just don't have any good examples or solutions to get me started. Thanks in advance. |
|
#2
|
||||
|
||||
|
homework?
did you just dream these questions up? If not, then there are two other possible scenarios - 1) you read them from an awk text book (the only ones I know of are the A. W. & K one and the O'Reilly one) - in which case, try reading the book, or 2) homework.
Have you even attempted this? What problems are you having? Why are you coming here when you haven't even shown a single line of code nor an error message or any inclination what so ever to attempt the problem yourself. These first time posts from n00bs irritate us enough for us to sit and write 2 paragraph-long rants in return. christo
__________________
. Spiration channels: Free scripts, programming tutorials and articles Dotcut alerts: Online Press cuttings / news alerts Clearprop: UK microlight school, wiltshire Uk dating: UK safe dating with Topdates About Christo . . |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > awk problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|