IZBORNIK HOME FORUM ACCESS EXCEL WORD  
 

HOME

   
1 UVOD
2 CMD sintaksa i XP naredbeni interpreter
3 Parametri i Prekidači
4 Kretanje pomoću tipki
5 Podešavanje prozora
6 Zamjenski znakovi
7 Editiranje TXTdatoteka
8 Posebni simboli u CMD naredbi
9 BATCH datoteke u CMD
10 HELP u CMD prozoru
11 ERROR u CMD prozoru
 

-- NAREDBE U  CMD-u --

  ASSOC
  AT
  ATTRIB
  BREAK
  CACLS
  CALL
  CD
  CHCP
  CHDIR
  CHKDSK
  CHKNTFS
  CLS
  CLIP
  CMD
  COLOR
  COMP
  COMPACT
  CONVERT
  COPY
  DATE
  DEL
  DIR
  DISKCOMP
  DISKCOPY
  DOSKEY
  ECHO
  ENDLOCAL
  ERASE
  EXIT
  FC
  FIND
  FINDSTR
  FOR
  FORMAT
  FTYPE
  GOTO
  GRAFTABL
  HELP
  IF
  LABEL
  MD
  MKDIR
  MODE
  MORE
  MOVE
  PATH
  PAUSE
  POPD
  PRINT
  PROMPT
  PUSHD
  RD
  RECOVER
  REM
  REN
  RENAME
  REPLACE
  RMDIR
  SET
  SETLOCAL
  SHIFT
  SORT
  START
  SUBST
  TIME
  TITLE
  TREE
  TYPE
  VER
  VERIFY
  VOL
  XCOPY
   
   
12 PING
13 IPCONFIG
14 NETSTAT
15 ROUTE
16 NSLOOKUP
17 ARP
18 TRACERT
19 TELNET
20 NET Commands
   
  .

NAREDBENO SUČELJE (Command Prompt line)

FINDSTR Search This Web Site

Adsense sponzor



 




FINDSTR

Naredba Findsrt (eng. Find String = nađi niz) traži zadani string u datotekama koristeći slovni niz ili standardne izraze. Findstr naredba je korisna kad se raspolažemo samo s dijelom informacije koju želimo pronaći. U tim slučajevima moguće je koristiti zamjenske znakove za nadopunu nepoznatih znakova u riječi ili rečenici. Po standardu findsrt je također osjetljiva na veličinu slova.

findstr [/b] [/e] [/l] [/c:string] [/r] [/s] [/i] [/x] [/v] [/n] [/m] [/o] [/g:file] [/f:file] [/d:dirlist] [/a:color attributes] [strings] [[drive:][path] filename [...]]

Parametar Značenje
/a Traži uzorak na početku linije
/c Traži uzorak na kraju linije
/c: string Koristi navedeni tekst kao string
/s Traži poklapajuće datoteke u aktivnom folderu i subfolderima
/i Određuje da potraga ne bude ovisna oveličini slova
/x Ispisuje linije u kojima se nalazi traženi niz
/v Ispisuje samo one linije koje ne sadrže traženi niz
/m Ispisuje samo naziv datoteke koja sadrži niz
/g file Nalazi niz u navedenoj datoteci

 

Znak Značenje
. bilo koji znak
* nijedan ili više znakova jednom ili više puta
^ početak linije
$ kraj linije
[x-y] bilo koji znak u rangu
\<xyz početak riječi
xyz\> kraj riječi

Primjer 1: Pronađi u dokumentima s nastavkom .txt sve riječi "FOR" i ispiši redni broj linije gdje se pojavljuje
findstr /b /n /c:" *FOR" *.txt

Primjer 2 : Potrebno je pronaći niz riječi zadnjih u datoteci finddata.txt. Te riječi treba pronaći u datotekama zadanim u datoteci filelist.txt. Rezltat naredbe pohrani u datoteku rezultat.txt
findstr /g:finddata.txt /f:filelist.txt > rezultat.txt

Primjer 3 : Pretraži u aktivnom kazalu i podkazalima sve datoteke i pronađi one u kojima se pojavljuje riječ "computer" neovisno o veličini slova.
findstr /s /i /m "\<computer\>" *.*

Primjer 4: Pronađi i svim dokumentima u aktivnom kazalu sve riječi koje počinju s "comp".
findstr /s /i /m "\<comp.*" *.*


Searches for patterns of text in files using regular expressions.

Syntax

findstr [/b] [/e] [/l] [/r] [/s] [/i] [/x] [/v] [/n] [/m] [/o] [/p] [/offline] [/g:file] [/f:file] [/c:string] [/d:dirlist] [/a:ColorAttribute] [strings] [[Drive:][Path] FileName [...]]

Parameters

/b

Matches the pattern if at the beginning of a line.

/e

Matches the pattern if at the end of a line.

/l

Uses search strings literally.

/r

Uses search strings as regular expressions. Findstr interprets all metacharacters as regular expressions unless you use /l.

/s

Searches for matching files in the current directory and all subdirectories.

/i

Specifies that the search is not to be case-sensitive.

/x

Prints lines that match exactly.

/v

Prints only lines that do not contain a match.

/n

Prints the line number before each line that matches.

/m

Prints only the file name if a file contains a match.

/o

Prints seek offset before each matching line.

/p

Skips files with non-printable characters.

/offline

Processes files with offline attribute set.

/f:file

Reads file list from the specified file.

/c:string

Uses specified text as a literal search string.

/g:file

Gets search strings from the specified file.

/d:dirlist

Searches a comma-delimited list of directories.

/a:ColorAttribute

Specifies color attributes with two hexadecimal digits.

strings

Specified text to be searched for in FileName.

[Drive:][Path] FileName [...]

Specifies a file or files to search.

/?

Displays help at the command prompt.

Remarks

  • Using regular expressions with findstr

Findstr is capable of finding the exact text you are looking for in any ASCII file or files. However, sometimes you have only part of the information that you want to match, or you want to find a wider range of information. In such cases, findstr has the powerful capability to search for patterns of text using regular expressions.

Regular expressions are a notation for specifying patterns of text, as opposed to exact strings of characters. The notation uses literal characters and metacharacters. Every character that does not have special meaning in the regular expression syntax is a literal character and matches an occurrence of that character. For example, letters and numbers are literal characters. A metacharacter is a symbol with special meaning (an operator or delimiter) in the regular-expression syntax.

The following table lists the metacharacters that findstr accepts.

Character

Value

.

Wildcard: any character

*

Repeat: zero or more occurrences of previous character or class

^

Line position: beginning of line

$

Line position: end of line

[class]

Character class: any one character in set

[^class]

Inverse class: any one character not in set

[x-y]

Range: any characters within the specified range

\x

Escape: literal use of metacharacter x

\<xyz

Word position: beginning of word

xyz\>

Word position: end of word

The special characters in regular expression syntax are most powerful when you use them together. For example, the following combination of the wildcard character (.) and repeat (*) character match any string of characters:

.*

Use the following expression as part of a larger expression that matches any string beginning with "b" and ending with "ing":

b.*ing

Examples

Use spaces to separate multiple search strings unless the argument is prefixed with /c. To search for "hello" or "there" in file x.y, type:

findstr "hello there" x.y

To search for "hello there" in file x.y, type:

findstr /c:"hello there" x.y

To find all occurrences of the word "Windows" (with an initial capital W) in the file Proposal.txt, type the following:

findstr Windows proposal.txt

To search every file in the current directory and all subdirectories that contained the word Windows, regardless of the letter case, type the following:

findstr /s /i Windows *.*

To find all occurrences of lines that contain the word "FOR", preceded by any number of spaces, (as in a computer program loop), and to include the line number where each occurrence is found, type the following:

findstr /b /n /c:" *FOR" *.bas

If you want to search for several different items in the same set of files, create a text file that contains each search criterion on a new line. You can also list the exact files you want to search in a text file. To use the search criteria in the file Finddata.txt, search the files listed in Filelist.txt, and then store the results in the file Results.out, type the following:

findstr /g:finddata.txt /f:filelist.txt > results.out

Assume you wanted to find every file in the current directory and all subdirectories that contained the word computer, regardless of the letter case. To list every file containing the word computer, type the following:

findstr /s /i /m "\<computer\>" *.*

Now assume you want to find not only the word "computer," but also any other words that begin with the letters comp, such as "compliment" and "compete. " type the following:

findstr /s /i /m "\<comp.*" *.*

 

Adsense sponzor



 




Copyright 2009-2017 - IvanC - ic.ims.hr