I need to be able to take the results from ls -l command and modify the output as follows:
I will run
ls -l *.mak
My results will be
aa.mak
bb.mak
cc.mak
I then need to take those results and create a file that has the following info:
dsjj/ubin/aa
dsjj/ubin/bb
dsjj/ubin/cc
Any help with script/awk/sed would be greatly apreciated.
Thanks
zedex
2
Not sure if i understood you correctly, you need want to list .mak files and then create file for every listed .mak file under some directory!!
Not tested!!
ls -l *mak | cut -d. -f1 | xargs -iFile touch <dir/path>/File
mirni
3
ls *.mak | while read i ; do echo "dsjj/ubin/${i%.mak}" ; done
or
ls *.mak | sed -e 's+^+/dsjj/ubin/+' -e 's/\.mak$//'
No pipes required:
for f in *.mak
do
echo "dsjj/ubin/${f%.*}"
done
---
or
for f in *.mak; do echo "dsjj/ubin/${f%.*}"; done
if you will