Sort of new to scripting, but here's what I want to do.
I've got a lot of files that get dumped into a single directory every morning. These file names only differ by their first four characters:
abcd-samesamesame
dcba-samesamesame
1234-samesamesame (etc.etc)
I have directories for abcd, dcba, 1234, etc. I'd like a script that takes anything starting with abcd, and automatically dump it into the abcd directory. Here's what I've got started:
#!/bin/sh
DUMDIR="/tftpimage"
FILE="abcd-*"
cd /tftpimage/configs
mv $FILE $DUMDIR/configs/abcd/
Is there a way to have:
FILE="first four characters of the filename"
and then
mv $FILE $DUMDIR/configs/"first four chars...."
Hope that makes sense....?
Start Free Trial