1
0
Fork
You've already forked skip
0
Skip part of a file.
  • Rust 60.4%
  • Shell 23.7%
  • Just 15.9%
Paul Campbell fc4219beae fix: resolve CI failures - DinD path translation and clippy pedantic lints
- Add Docker-in-Docker host path translation to ci recipe
- Fix missing_errors_doc on pub fn skip()
- Fix uninlined_format_args in writeln! calls
- Remove obsolete Forgejo workflow files
- Add .cache and .output-*.log to .gitignore
2026年05月17日 19:31:50 +00:00
.crow ci: add CrowCI workflow and add ci recipe to justfile 2026年05月17日 19:31:50 +00:00
src ci: add CrowCI workflow and add ci recipe to justfile 2026年05月17日 19:31:50 +00:00
tests skip until matching tokens seen 2023年03月22日 07:21:16 +00:00
.gitignore ci: add CrowCI workflow and add ci recipe to justfile 2026年05月17日 19:31:50 +00:00
Cargo.lock fix: remove unneeded ssl/tls dependencies 2025年01月18日 17:15:54 +00:00
Cargo.toml fix: remove unneeded ssl/tls dependencies 2025年01月18日 17:15:54 +00:00
justfile fix: resolve CI failures - DinD path translation and clippy pedantic lints 2026年05月17日 19:31:50 +00:00
README.md docs(readme): remove unfullfilled promise 2024年11月22日 08:57:01 +00:00
renovate.json chore(renovate): update update major and minor version 2024年05月14日 14:02:38 +01:00
test.sh chore(deps): update git.kemitix.net/kemitix/rust docker tag to v4 2025年01月16日 14:26:11 +00:00

skip

Skip part of a file.

As head will show the top of a file up-to a number of line, so skip will do the opposite, and not show the top of the file, but will show the rest.

Additionally, it can check for whole lines matching, or for a token being present on the line.

N.B.: The skip crate used to be an implementation of Skip list, by Luo Jia / Zhouqi Jiang (source).

Usage

Skip a fixed number of lines

This example reads the file from stdin.

echo "line 1
line 2
line 3
line 4" > input.txt
skip 2 < input.txt

Will output:

line 3
line 4

Skip until a number of matching lines

The whole line must match.

This example reads the named file.

echo "alpha
beta
alpha
alpha
gamma
alpha" > input.txt
skip 2 --line alpha input.txt

Will output:

alpha
gamma
alpha

Skip lines until a number of tokens are seen

Looks for a string within a line, counting each occurance.

This example reads the file from stdin.

echo "Lorem ipsum dolor sit amet, 
consectetur adipiscing elit, 
sed do eiusmod tempor incididunt 
ut labore et dolore magna aliqua. 
Ut enim ad minim veniam, 
quis nostrud exercitation ullamco 
laboris nisi ut aliquip ex ea 
commodo consequat." > input.txt
cat input.txt | skip 2 --token dolor

Will output:

Ut enim ad minim veniam, 
quis nostrud exercitation ullamco 
laboris nisi ut aliquip ex ea 
commodo consequat.

It matches the first dolor on line 1, and the second on line 4 as part of the word dolore.

Skip lines until a lines with tokens are seen

Looks for a string within a line, only counting each matching line once.

This example reads the file from stdin.

echo "Lorem ipsum dolor sit amet, 
consectetur adipiscing elit, 
sed do eiusmod tempor incididunt 
ut labore et dolore magna aliqua. 
Ut enim ad minim veniam, 
quis nostrud exercitation ullamco 
laboris nisi ut aliquip ex ea 
commodo consequat." > input.txt
cat input.txt | skip 4 --token m --ignore-extras

Will output:

quis nostrud exercitation ullamco 
laboris nisi ut aliquip ex ea 
commodo consequat. 

Without --ignore-extras, it would have found the fourth m on line 3.

echo "Lorem ipsum dolor sit amet, 
consectetur adipiscing elit, 
sed do eiusmod tempor incididunt 
ut labore et dolore magna aliqua. 
Ut enim ad minim veniam, 
quis nostrud exercitation ullamco 
laboris nisi ut aliquip ex ea 
commodo consequat." > input.txt
cat input.txt | skip 4 --token m

Outputing:

ut labore et dolore magna aliqua. 
Ut enim ad minim veniam, 
quis nostrud exercitation ullamco 
laboris nisi ut aliquip ex ea 
commodo consequat.