Results 1 to 5 of 5
hi all,
can any one help with writting a unix script that knows to pull out from a file a string and retype it to a new file.
the string ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-04-2007 #1Just Joined!
- Join Date
- Jan 2007
- Posts
- 27
Need help with beginners unix script
hi all,
can any one help with writting a unix script that knows to pull out from a file a string and retype it to a new file.
the string could appear in the file with a different value but its structure is the same (for example: "1A:CB:43:8D"), and the position of it in the line is always in the same place.
after the new file will be created, another function should go over it, and calculate and print the number of appearance of each string.
i will appreciate your help
- 02-04-2007 #2Linux User
- Join Date
- Aug 2006
- Location
- Croydon, PA
- Posts
- 392
I guess this should have been posted in the "Scritps" section but any who...
Need more info like a partial of the file you are getting te info from.Good Luck,
Ski
RHCT
- 02-07-2007 #3Just Joined!
- Join Date
- Jan 2007
- Posts
- 27
dear ski
"I guess this should have been posted in the "Scritps" section but any who..."
U mentioned it should be posted in scripts section. I don't know about the scripts section.
Need more info like a partial of the file you are getting te info from.
What u need more info ??
- 02-07-2007 #4Linux Newbie
- Join Date
- Jan 2007
- Location
- Cupertino, CA
- Posts
- 157
Are you trying to get the forum to help with your college assignments?
Anyway, grep is the command you are looking for. Try to build a script around it. Following is an example...
#!/bin/sh
fname=$1
grep ".{99}[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]" $fname | wc -w
will do what you asked for (assuming at 100th position in the file) without an intermediate file. (I have not tested this, but you can play with it until you get it right).
Suggest to get a good book on Regular Expressions or simply read man pages for grep, regex(7), perlre etc...
- 02-07-2007 #5Just Joined!
- Join Date
- Jan 2007
- Posts
- 27
Thanks for you reply,
ha ha ha
For your information I am not a student to do my assingment. My hobby is to learn Linux. I used to get the help of my friends / forums.


Reply With Quote
