| Author |
one liner to search a file
|
|
|
| hi
i need to search a file which contains the data below and extract the
machine name only in this case 'e215c03' and overwrite the file.
many thanks for your help.
Name: e215c03.internal.co.uk
Address: 10.40.10.15
| |
| Ian Wilson 2005-06-09, 3:57 pm |
| h3r0 wrote:
> hi
>
> i need to search a file which contains the data below and extract the
> machine name only in this case 'e215c03' and overwrite the file.
>
> many thanks for your help.
>
>
> Name: e215c03.internal.co.uk
> Address: 10.40.10.15
>
perl -n -i -e '/^Name:\s+([^\.]+)/ && print $1' filename
| |
|
| it wanted a backup file name, works great your a star! :)
thanks for your fast responses.
Ian Wilson wrote:
> h3r0 wrote:
>
>
> perl -n -i -e '/^Name:\s+([^\.]+)/ && print $1' filename
| |
| axel@white-eagle.invalid.uk 2005-06-09, 8:57 pm |
| h3r0 <h3r0@my-deja.com> wrote:
> it wanted a backup file name, works great your a star! :)
> thanks for your fast responses.
>
> Ian Wilson wrote:
>
| |
| axel@white-eagle.invalid.uk 2005-06-09, 8:57 pm |
| Ian Wilson <scobloke2@infotop.co.uk> wrote:
> h3r0 wrote:
[color=darkred]
[color=darkred]
> perl -n -i -e '/^Name:\s+([^\.]+)/ && print $1' filename
^
|
What purpose does the backslash serve?
Axel
|
|
|
|