#] #] ********************* #] "$d_SysMaint"'Linux/cut notes, remove sections from each line of files.txt' - # www.BillHowell.ca 19Jul2022 initial # view in text editor, using constant-width font (eg courier), tabWidth = 3 cut byte positions are numbered from 1 (not 0) extract line(number) from a file : see "$d_SysMaint"'awk notes.txt" #48************************************************48 #24************************24 # Table of Contents, generate with : # $ grep "^#]" "$d_SysMaint"'Linux/cut notes, remove sections from each line of files.txt' | sed "s/^#\]/ /" # #24************************24 # Setup, ToDos, #08********08 #] ??Nov2023 #08********08 #] ??Nov2023 #08********08 #] ??Nov2023 #08********08 #] ??Nov2023 #08********08 #] ??Nov2023 #08********08 #] ??Nov2023 #08********08 #] ??Nov2023 #08********08 #] 07Nov2023 cut the last chr https://www.geeksforgeeks.org/remove-last-character-from-string-in-linux/ $ echo "linux" | sed 's/.$//' #08********08 #] 20Sep2023 pinn_timeModTo_yymmddhms() 'standard header.sh' " # pinn_timeModTo_yymmddhms() - for some-dir backups # from "$d_web"'CompLangs/PineScript/PuetzUWS IntlStkIdxs multi-fractals.txt' # 02Sep2023 initial, ignore UTC cirrection for now (not used for my p_log fNames) pinn_timeModTo_yymmddhms() { pinn="$1" timeStat=$( stat "$d_SysMaint""Linux/files - get attributes.txt" | grep 'Modify' | cut --bytes=11,12,14,15,17,18,19,20,21,22,23,24,25,26,27,28 | sed 's|:|h|g;s|\.|s|;s|h\([0-9]*\)h|h\1m|' ) date -d "$timeStat" +%s } #08********08 #] 11Sep2023 search "Linux cut with a range of bytes" +----+ https://phoenixnap.com/kb/linux-cut Linux cut Command Explained with 6 Examples November 29, 2021 -c (--characters=LIST) Select using a specified character, a character set, or a character range. who | cut -c 1-8 #08********08 #] 02Sep2023 date_ymdhms_to_unixTime() example in "$d_bin""standard header.sh" year=$( echo "$lastUpdate" | cut --bytes=1,2 ) mnth=$( echo "$lastUpdate" | cut --bytes=3,4 ) dayy=$( echo "$lastUpdate" | cut --bytes=5,6 ) hour=$( echo "$lastUpdate" | cut --bytes=8,9 ) mint=$( echo "$lastUpdate" | cut --bytes=11,12 ) scnd=$( echo "$lastUpdate" | cut --bytes=14,15 ) # echo '230902 9h19m03' | cut --bytes=1,2 # echo '230902 9h19m03' | cut --bytes=14,15 # echo '230902 9h19m03' | cut --bytes=8,9 # $ bash "$d_SysMaint"'Linux/cut notes, remove sections from each line of files.txt' # enddoc