Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

cat(1) golf

NotificationsYou must be signed in to change notification settings

wader/catgolf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 

Repository files navigation

Get the file to stdout as intact as possible.

Pure league

  • No shell features are involved.
  • Only outputs tostdout.
cat file.txtawk 1 file.txtpaste file.txtpv -q file.txtpr -t file.txtsed b file.txtgrep ^ file.txtgrep $ file.txtsed'' file.txtgrep'' file.txtsort -m file.txtlook'' file.txtjq -rR. file.txtsed -n p file.txtcut -b 1- file.txtjq -jRs. file.txtperl -pe1 file.txttail -n +1 file.txthead -n -0 file.txt# GNU headcp file.txt /dev/fd/1gcc -E -P -xc file.txtscp file.txt /dev/fd/1column -t -l 1 file.txtcomm file.txt /dev/null# BSD commw3m -dump_source file.txtdd status=none if=file.txt# GNU ddhexdump -ve'"%c"' file.txtsplit --filter=tee file.txt# GNU splitjoin -a 1 file.txt /dev/nullopenssl enc -none -in file.txtcurl file:///proc/self/cwd/file.txtgit -P grep --no-index -h ^ file.txtshuf --random-source=/dev/zero file.txtbat --color=never --style=plain file.txtdiff --line-format=%L /dev/null file.txtvim -es --clean'+w! /dev/fd/1''+q!' file.txtpython -c'print(open("file.txt").read()[:-1])'ffmpeg -v quiet -f data -i file.txt -map 0:0 -c text -f data -emacs -Q --batch --eval'(princ (with-temp-buffer (insert-file-contents "file.txt") (buffer-string)))'

Shell league

  • Can use shell feature like pipes, redirect etc to work.
tee< file.txt< file.txt>&1# assuming zsh and default NULLCMDtr a a< file.txtrev file.txt| revtac file.txt| tacecho',p'| ed -s file.txtxxd -p file.txt| xxd -p -r

Brittle league

  • May not handle every character.
  • May not handle every file length.
sed'/*/p' file.txtgcc -E -P -xc file.txt

Error league

  • Same as "Pure league", but errors onstdout and/orstderr are acceptable.
dd if=file.txtgcc -xc file.txt

Junk league

  • Same as "Error league", but most of the output bytes are from the file.
m4 file.txt# Does not handle lines that starts with `#` or looks like definitions.fold file.txt# Works for files without long lineswall -n file.txt# I hope your file doesn't have any secretsuniq -Dw0 file.txt# Doesn't work for single-line filesxargs -d\n -a a.txtecho# Ends up with a trailing newlinemore -e -n 65535 file.txt# Works for files with less than 65k lines.nl -bn -w 1 -s'' file.txt# Each line has an extra spacewhileread l;doecho$l;done< file.txt# See emanuele6's comment: https://github.com/wader/catgolf/pull/63#issuecomment-2164030897

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp