:wall::wall::wall:
Hi I have horrible script below, need help in renaming ls -l output into new filename format:
Desired output:
cp -pv original_path/.* newDirectory/owner_of_file.%dd%mm%y.file_extension.first_8_characters_of_original_filename
localuser@localuser:~ vi renamefiles.sh
#!/bin/bash
a=alice
t=ted
c=carol
b=bob
date=$(ls -l --time-style="+%m %d %y" wiz | egrep -f alice.filenames | grep defs | sed 's/.defs/ /g' | awk '{print $6$7$8}')
mkdir -pv newWiz/large newWiz/small newWiz/alice/large newWiz/alice/small
for largefiles in $(cat alice.large | sed 's/\.defs$//g' | awk '{print $NF}' | cut -c1-8)
do
echo -e $a$date$largfiles ;
done
---------- Post updated at 01:46 PM ---------- Previous update was at 01:44 PM ----------
cat list.txt #sample out from ls -l
-rwx------- 1 alice staff 1586 2010-11-05 02:27 request-key.conf
-rwx------- 1 ted staff 126 2011-04-29 13:54 cvs-pserver.conf
-rwx------- 1 carol staff 644 2011-03-06 21:58 ts.conf
---------- Post updated at 01:47 PM ---------- Previous update was at 01:46 PM ----------
so far I have extracted the date, owner, and first 8 characters
However I figured out how can I combine them accordingly without overlapping each output results??? :wall: