I'm trying to get every single character of every single line in a given file and then do convertnum() (Assume that the function works perfectly) on each single character. Here is what I have so far:
#!/bin/bash
file1=$1
while read -r line
do
//I want to iterate over each "line" and then do convertnum "char" on every single character within the line but I don't know how to do it.
done
done < "$file1"
xxd?convertnumis just a simple replacement function, you don't really need to access the entire file at once. If you need access to all the previous and subsequent lines, you can similarly read the entire file into an array.lineis a string, so use string processing functions.for (( i = 0; i < ${#line}; i++ )); do convertnum "${line:i:1}"; done