How Do I Parse a String?
Posted
by Russ
on Super User
See other posts from Super User
or by Russ
Published on 2010-04-23T18:09:37Z
Indexed on
2010/04/23
18:14 UTC
Read the original article
Hit count: 188
I am new to bash, and I am creating a script that loops through the files in a directory and based on part of the filename, does something with the file, so far I have this:
#!/bin/bash
DIR="/Users/me/Documents/import/*"
for f in "$DIR"
do
$t=??????
echo "Loading $f int $t..."
done
so $f
will output something like this: /Users/me/Documents/import/time_dim-1272037430173
out of this, I want time_dim
, the directory can be variable length and -1272037430173
is a fixed length (it's the unix timestamp btw).
What is the best way to go about this?
© Super User or respective owner