Hi getgle/get52, when looking at the manual of cat there are a bunch of options that cat provides that your php rewrite of cat does not provide.
-A, --show-all
equivalent to -vET
-b, --number-nonblank
number nonempty output lines, overrides -n
-e equivalent to -vE
-E, --show-ends
display $ at end of each line
-n, --number
number all output lines
-s, --squeeze-blank
suppress repeated empty output lines
-t equivalent to -vT
-T, --show-tabs
display TAB characters as ^I
-u (ignored)
-v, --show-nonprinting
use ^ and M- notation, except for LFD and TAB
--help display this help and exit
--version
output version information and exit
I tried to write in cat in python (I don't know how to code in PHP) and made some of these options. A lot of them are useless but the main actually usefule ones I think are being able to see a concatenated version of multiple files and being able to see a line count.
https://codeberg.org/zortazert/Python-Projects/src/branch/main/gnu/pof.py
# POF - Print Out Files
import sys
import os
args = sys.argv[1:]
special = ["-n", "-b",]
if args == []:
print("No arguments were given")
quit()
if "-h" in args:
print("""Usage:
- python pof.py [FILE]
Print out contents of given file (if they exist)
- python pof.py [FILE] [FILE2] [FILE3]
Print out all given files (if they exist)
- python pof.py -n [FILE]
Print out numbered the lines in the file.
- python pof.py -b [FILE]
Print out numbered only blank lines in the file.
- python pof.py -h
Pring out this help""")
quit()
num=0
for arg in args:
if os.path.isfile(arg):
with open(arg) as f:
if "-n" in args:
for line in f.read().splitlines():
num = num+1
print(num, line)
elif "-b" in args:
for line in f.read().splitlines():
if line == "":
print(line)
else:
num = num+1
print(num, line)
else:
print(f.read())
elif arg in special:
pass
else:
print(f'Can not find "{arg}"')
Hi getgle/get52, when looking at the manual of cat there are a bunch of options that cat provides that your php rewrite of cat does not provide.
I tried to write in cat in python (I don't know how to code in PHP) and made some of these options. A lot of them are useless but the main actually usefule ones I think are being able to see a concatenated version of multiple files and being able to see a line count. https://codeberg.org/zortazert/Python-Projects/src/branch/main/gnu/pof.py