Answer the question
In order to leave comments, you need to log in
How to replace multiple occurrences in a string with sed?
Tell me, you need to convert the permissions displayed by the ls -l command from the rwx type to the read-write-execute type, without replacing r, w, x in the rest of the output.
Answer the question
In order to leave comments, you need to log in
Maybe so?
a=$(ls -l | tail -n +2)
while read line
do
b=$(echo "$line" | awk '{print $1}' | sed -e 's/r/read/g' | sed -e 's/x/execute/g' | sed -e 's/w/write/g' )
c=$(echo "$line" | awk '{for (i=2; i<=NF; i++ ) print $i}')
echo $b $c >> ls.txt
done <<< "$a"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question