1

How to traverse a file and extract strings using their index?

view story
linux-howto

http://unix.stackexchange.com – The given file must not be stored in variable and then traversed due to memory size restrictions: Example: var=$(cat FILE) for i in $var do echo $i done How do you traverse all strings in a file in the same way as the example above but extract each string directly from the file? Example: fileindex=1 totalfilecount=$(cat FILE | wc -w) while (( ${fileindex} <= ${totalfilecount} )) do onefilename= ??? missing command using fileindex ((fileindex+=1)) done Is there a command that can view a file as an array and allow you to extract strings using their index positions? The idea is (HowTos)