Read any lines of text from file

Witam wszystkich ,

Jest to moj pierwszy post i ju proba ale gdybym potrafi zaradzi problemowi to nie zawracabym nikomu gowy .

mianowicie :

Mam jakis 'plik' w ktorym s osadzone pojedyncze i zmienne sowa po jednym w lini czyli :

test1
tekttw
resst
.... itd.

Moje pytanie brzmi :

  • jak mam odczyta z tego pliku konkretn linie i przekaza wyjcie do innego pliku ? Czy jest jakie polecenie kt�re to umoliwia w prosty spos�b ?

Pozdrawiam

Bitte ne pas parlare po Polsku pero in English graag...

sory ,

Hi all,

This is my first post and I asked if I could but it did not address this problem would bother anyone's head.

namely:

I have a 'file' in which they are embedded single and variable words in one line that is:

test1
tekttw
resst
.... itd.

My question is:

  • As I read from this file and specific line of the output to another file? Is there a command that enables the easy way?

Do you mean like this?

grep tekttw file > found.txt

not the case, has further explained:

I am doing a script that queries the ports of my server and saves results to a file in the form:

=== file wyn1.log ===
open
closed
closed
open
open

the first line is the first port of argument given in the script for the second line is the second port of script given as an argument ........

I need to read any line.


nmap -n -r -p$port $domena | awk 'BEGIN {RS=" "} /closed/ || /open/ ' >>  wyn1.log

So far, I checked the port so only one option

echo-e "Port $port is:` head wyn1.log `" >> end.log 

but I want to query enough clicks away at the same time my question.

Know, words will be repeated in a different order, and will focus on different ports.

Instead of "head wyn1.log" try:

awk NR==$port wyn1.log

or

sed -n ${port}p wyn1.log

or

sed $port\!d wyn1.log

Thanks