LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   read file and analyze position (https://www.linuxquestions.org/questions/linux-newbie-8/read-file-and-analyze-position-73897/)

j-me 07-18-2003 01:39 PM

read file and analyze position
 
Trying to write a script;
1. to read a defined file (each line)
2. select a defined position in line (30) and place in temp-variable.
3. scan file for name.$temp-variable.
4. if found generate an email found.
5. if not generate email not found.

1. & 2. has me stumped?
any ideas?

deepika 07-18-2003 02:50 PM

well, it depends on which scripting language (bash, PERL) u want to use..

j-me 07-18-2003 02:51 PM

BASH

deepika 07-18-2003 05:54 PM

you can use awk to do the same....something like below goes in your shell script

FILENAME="myfile"

awk 'BEGIN {POS="30"}
{

/* your code execouted for each line of file */

}' $FILENAME


All times are GMT -5. The time now is 06:55 PM.