Searching within Text
-
findstr: Search for strings in files.-
/I: Ignore case. -
/S: Searches for matching files in the current directory and all subdirectories. -
/V: Print only lines that do not contain a match.
C:\> findstr "search_term" file.txt This line contains the search_term. -
```bash
C:\> findstr /I "Search_Term" file.txt
This line contains the search_term.
```
Filtering and Transforming Text
There's no direct equivalent to
awkin Windows, but you can use PowerShell or other scripting languages for similar tasks.powershell -Command "(Get-Content file.txt) -replace 'World', 'Universe'": Use PowerShell to replace text.
C:\> echo Hello World | powershell -Command "$input -replace 'World', 'Universe'"
Hello Universe
Sorting and Counting
-
sort: Sort input.
C:\> echo banana & echo apple & echo cherry | sort
apple
banana
cherry
- There's no direct
uniqequivalent in Windows, but you can use PowerShell for similar tasks. -
find /c /v "": Count lines in a file.
C:\> echo Hello World | find /c /v ""
1
Text Display
-
type: Display the content of files.
C:\> type file.txt
This is the content of file.txt.
- There's no direct
tacequivalent in Windows, but you can use PowerShell for similar tasks. -
more +n: Display content starting from the nth line. (Similar totail)
C:\> echo line1 & echo line2 & echo line3 | more +1
line2
line3
Top comments (0)