#!/usr/bin/perl my $file = "/home/user/ip"; my $zeile; my @inhalt; #print"IP Adress:\n"; #$ersetze = ; open(DATEI,"+<$file"); @inhalt=; close(DATEI); my $suchwort ="test4"; for($i = 0; $i < @inhalt; $i ++) { my $pos = index($inhalt[$i], $suchwort); if($pos > -1){ my $nextword = index($inhalt[$i], ' ', ($pos + length($suchwort))) -13; my $ip = substr($inhalt[$i], $nextword); @array=split(/#/,$ip); $erster=shift(@array); print $ip; exit; } }