# Leitura e Manipulação

### Leitura

Lendo o conteúdo de um arquivo

```
cat <file>
type <file>
gc <file>
```

Paginando conteúdo do arquivo, semelhante ao `more` do Linux

```
# Prompt de Comando
type <file> | more

# Powershell
type <file> | Out-Host -Paging 
```

### findstr

Filtrando por palavras (Case Sensitive)

```
findstr <search> <file>
findstr <search> <file> | findstr <other_filter>
```

Filtrando por palavras (Case Insensitive)

```
findstr -i <search> <file>
```

Pesquisando por senhas

```
findstr /s "password" *.txt
```

Filtrando por linha inteiras

```
findstr -x <search_line> <file>
```

Oculta todas as linhas que contém determinada ocorrência

```
findstr -v <negative_string> <file>
```

Todas as linhas que começam o caractere `a`

```
findstr ^a <file>
```

Todas as linhas que terminam o caractere `s`

```
findstr s$ <file>
```

Todas as linhas que começam o com caractere `a` e termina com `s`

```
findstr ^a.*s$ <file>
```

### Criando Arquivos e Diretórios

#### Arquivos

```bash
# Prompt de Comando
NUL> <file.txt>

# Powershell
New-Item -Path '<C:\temp\file.txt>' -ItemType File
```

#### Diretório

```
New-Item -Path '<C:\temp\new-folder>' -ItemType Directory
```

### Arquivos Ocultos

Oculta um diretório ou arquivo (não deixa os subdiretórios ocultos)

```bash
attrib +h <diretorio_ou_arquivo>
```

Deixa um diretório ou arquivo visível

```bash
attrib -h <diretorio_ou_arquivo>
```

Visualizando arquivos todos os arquivos (incluindo os ocultos)

```bash
dir /a
```

### Descompatando Arquivos

#### zip

```bash
Expand-Archive <file.zip>
```

#### Sites

```
https://docs.microsoft.com/pt-br/windows-server/administration/windows-commands/findstr
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mysther.gitbook.io/knowledge-base/sistemas-operacionais/windows/utilizacao/trabalhando-com-arquivos/leitura-e-manipulacao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
