hi peeps, does anyone know how to extract the first 3 character in a text using shell?
I have something like
which obviously doesnt work because I dont know how to reference a variable inside awk, is this possible? Basivally what I am trying to do is extract the first 3 character of directory names inside dir.txtCode:for x in `grep "$" dir.txt`
do
set -x
echo $x
awk '{print substr('$x', 1,3)}'
done
Btw is it possible to list just directories but not files using ls -al ?