FIND YOUR NEXT FEW LINES

Results for “line history”

Small, practical examples. Search by task or narrow things down below.

150 snippets foundClear filters
Bash ScriptsLoops & decisions

Read a file without losing its last line

Handle spaces, backslashes, and a final line without a newline.

read lines✓ Tested
Bash ScriptsGetting Started

Read a line without losing backslashes

Bash Scripts: Read a line without losing backslashes with a small standalone Bash program.

Bash Scripts✓ Tested
RustFiles & paths

Read buffered lines from a file

Read buffered lines from a file in a complete Rust program using the standard library.

Rust✓ Tested
Bash ScriptsInput streams & redirection

Read complete lines into an array

Bash Scripts: Mapfile with -t removes each line terminator but preserves other whitespace.

Bash Scripts✓ Tested
GitGetting Started

Read history for one path

Git: Read history for one path inside the disposable repository created by the input setup.

Git✓ Tested
PythonStructured data & serialization

Read one JSON document per line

Python: Parse nonempty JSON Lines records independently instead of loading a JSON array.

Python✓ Tested
GoFiles & paths

Read text line by line

Read text line by line using a complete Go program with explicit sample inputs.

Go✓ Tested
Bash ScriptsText parsing & arithmetic

Remove a trailing carriage return from a line

Bash Scripts: Use an ANSI-C quoted carriage return as the suffix pattern.

Bash Scripts✓ Tested
CStrings

Remove a trailing line ending

Use strcspn to terminate a C string at its first newline or carriage return.

C✓ Tested
Linux CommandsGetting Started

Remove adjacent duplicate lines

Linux Commands: Remove adjacent duplicate lines using GNU/Linux commands in an empty practice directory.

Linux Commands✓ Tested
Linux CommandsTransforming text

Remove blank or whitespace-only lines

Linux Commands: Use a POSIX character class so tabs and spaces are handled together.

Linux Commands✓ Tested
Linux CommandsGetting Started

Replace text in a pipeline

Linux Commands: Replace text in a pipeline using GNU/Linux commands in an empty practice directory.

Linux Commands✓ Tested