You guys seem pretty smart....

Discussion in 'NZ Computing' started by Andrew, Sep 10, 2005.

  1. Andrew

    Andrew Guest

    Im sure this is possible, Im just not sure how to do it

    i have a text file called "list"

    it contains:
    bldg_whitehallBuildingAnnex 263341
    bldg_woolworth 262737
    Queensboro 248950
    Williamsburg 248948
    Brooklyn 255674

    i also have a script called uid2mov.pl which uses the numbers in the
    above list to get a directory location relative to the number

    Ive used this command on the list:
    cat list | awk '{system (" ~alambert/scripts/uid2mov.pl " $2)}' | awk
    '{system ("cp " $1" /vol/tempwrangler/andrew/hannah1/")}'

    which executes:
    cp
    /vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    /vol/tempwrangler/andrew/hannah1/
    cp
    /vol/shotsub/Movies/kong/Assets/hybridWoolworth/kong_Assets_hybridWoolworth_Take-4.1k.mov
    /vol/tempwrangler/andrew/hannah1/
    cp
    /vol/shotsub/Movies/kong/Assets/queensboroBridge/kong_Assets_queensboroBridge_Take-3.1k.mov
    /vol/tempwrangler/andrew/hannah1/
    cp
    /vol/shotsub/Movies/kong/Assets/williamsburgBridge/kong_Assets_williamsburgBridge_Take-2.1k.mov
    /vol/tempwrangler/andrew/hannah1/
    cp
    /vol/shotsub/Movies/kong/Assets/brooklynBridge/kong_Assets_brooklynBridge_Take-2.1k.mov
    /vol/tempwrangler/andrew/hannah1/


    My question is... how to get a different output, ie putting the numbers
    from the list into the destination filename:
    cp
    /vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    /vol/tempwrangler/andrew/hannah1/kong_Assets_hybrid_Take-28.1k.263341.mov

    all Using a single line command

    from the answer i can probably work out how to make it:
    cp
    /vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    /vol/tempwrangler/andrew/hannah1/kong_Assets_hybrid_Take-28.1k.263341_bldg_whitehallBuildingAnnex.mov

    note, i already have a script that does all of this, Im just reasonably
    new to awk and i was wondering what i needed to add to the command to
    get what i want

    in fact im new to linux all together, so most commands i dont actually
    know about
     
    Andrew, Sep 10, 2005
    #1
    1. Advertising

  2. Andrew

    H.O.G Guest

    On Sat, 10 Sep 2005 13:44:30 +1200, Andrew
    <> spoke these fine words:

    >
    >Im sure this is possible, Im just not sure how to do it


    Don't ask Shane - it'll take him a month!!
     
    H.O.G, Sep 10, 2005
    #2
    1. Advertising

  3. Andrew

    Shane Guest

    On Sat, 10 Sep 2005 21:01:40 +1200, H.O.G wrote:

    > On Sat, 10 Sep 2005 13:44:30 +1200, Andrew <>
    > spoke these fine words:
    >
    >
    >>Im sure this is possible, Im just not sure how to do it

    >
    > Don't ask Shane - it'll take him a month!!


    Gosh... I am pleased you replyed to the poor guys post with a flame, Im
    sure he will go back to work thinking what wonderful people nz.comp are.
    FWIW it would take me quite some time, as Im not up to speed (at all) with
    awk, although as you can see, Im man enough to admit my shortcomings

    Someone asked if you were 5 years old, it seems they are fairly accurate
    in their guess

    --
    Hardware, n.: The parts of a computer system that can be kicked

    The best way to get the right answer on usenet is to post the wrong one.
     
    Shane, Sep 10, 2005
    #3
  4. Andrew

    H.O.G Guest

    On Sat, 10 Sep 2005 21:06:44 +1200, Shane <-a-geek.net>
    spoke these fine words:

    >On Sat, 10 Sep 2005 21:01:40 +1200, H.O.G wrote:
    >
    >> On Sat, 10 Sep 2005 13:44:30 +1200, Andrew <>
    >> spoke these fine words:
    >>
    >>
    >>>Im sure this is possible, Im just not sure how to do it

    >>
    >> Don't ask Shane - it'll take him a month!!

    >
    >Gosh... I am pleased you replyed to the poor guys post with a flame, Im
    >sure he will go back to work thinking what wonderful people nz.comp are.
    >FWIW it would take me quite some time, as Im not up to speed (at all) with
    >awk, although as you can see, Im man enough to admit my shortcomings
    >
    >Someone asked if you were 5 years old, it seems they are fairly accurate
    >in their guess


    What's that, stalker?

    Bit hot under the collar, there, turniphead?
     
    H.O.G, Sep 10, 2005
    #4
  5. Andrew

    Shane Guest

    On Sat, 10 Sep 2005 22:11:39 +1200, H.O.G wrote:

    > On Sat, 10 Sep 2005 21:06:44 +1200, Shane <-a-geek.net>
    > spoke these fine words:
    >
    >>On Sat, 10 Sep 2005 21:01:40 +1200, H.O.G wrote:
    >>
    >>> On Sat, 10 Sep 2005 13:44:30 +1200, Andrew <>
    >>> spoke these fine words:
    >>>
    >>>
    >>>>Im sure this is possible, Im just not sure how to do it
    >>>
    >>> Don't ask Shane - it'll take him a month!!

    >>
    >>Gosh... I am pleased you replyed to the poor guys post with a flame, Im
    >>sure he will go back to work thinking what wonderful people nz.comp are.
    >>FWIW it would take me quite some time, as Im not up to speed (at all)
    >>with awk, although as you can see, Im man enough to admit my shortcomings
    >>
    >>Someone asked if you were 5 years old, it seems they are fairly accurate
    >>in their guess

    >
    > What's that, stalker?
    >
    > Bit hot under the collar, there, turniphead?


    It appears you are, go have a lie down before you make a dick of yourself
    *again*


    Before you rush off though, why do you call misfit a convict, yet tell
    Michael George that you yourself have smoked pot and feel its a victemless
    crime?
    Are you that low?


    --
    Hardware, n.: The parts of a computer system that can be kicked

    The best way to get the right answer on usenet is to post the wrong one.
     
    Shane, Sep 10, 2005
    #5
  6. Andrew

    Shane Guest

    On Sat, 10 Sep 2005 13:44:30 +1200, Andrew wrote:
    Hi andrew,
    What you want is to add regular expressions into your awk statements,
    specifically you are looking at
    awk ' {sub(/$/,"$2")}'

    http://www.student.northpark.edu/pemente/awk/awk1line.txt

    Im not too handy with awk at all (in fact I got the above from google)
    the substitution means as follows
    sub <<-- no prizes here
    /$/ <<-- at the end of the line
    "$2" <<-- Im guessing you can pass $2 (which contains the info you want
    added to the end of the line)

    Also Im not sure if you want everyone to know your full name and place of
    work (although working in mirimar is something to be proud of indeed;-)
    so a bit of judicious snipping might be in order in future
    HTH


    --
    Hardware, n.: The parts of a computer system that can be kicked

    The best way to get the right answer on usenet is to post the wrong one.
     
    Shane, Sep 10, 2005
    #6
  7. In article <2UqUe.10274$>,
    Andrew <> wrote:

    >Im sure this is possible, Im just not sure how to do it
    >
    >i have a text file called "list"
    >
    >it contains:
    >bldg_whitehallBuildingAnnex 263341
    >bldg_woolworth 262737
    >Queensboro 248950
    >Williamsburg 248948
    >Brooklyn 255674
    >
    >i also have a script called uid2mov.pl which uses the numbers in the
    >above list to get a directory location relative to the number
    >
    >Ive used this command on the list:
    >cat list | awk '{system (" ~alambert/scripts/uid2mov.pl " $2)}' | awk
    >'{system ("cp " $1" /vol/tempwrangler/andrew/hannah1/")}'


    I don't think I would bother with awk for this. bash should be powerful
    enough for the job.

    First of all, you should be able to separate out the lines of the file
    as follows:

    SAVEIFS="$IFS"; IFS=$'\n'
    declare -a lines; lines=($(< list))
    IFS="$SAVEIFS"

    Then you can iterate over the entries something like:

    for ((i=0; i < ${#lines[*]}; ++i))
    do
    parms=(${lines[$i]})
    cp $(~alambert/scripts/uid2mov.pl ${parms[1]}) \
    /vol/tempwrangler/andrew/hannah1/kong_Assets_ ${parms[1]}.
    ${parms[0]}.mov
    done

    (Haven't tested this!) Not sure if that gives exactly the file names you
    want, though.

    If you want more complex construction of destination filenames from
    source ones, I would recommend using a Perl script.
     
    Lawrence D¹Oliveiro, Sep 10, 2005
    #7
  8. Andrew

    Brendan Guest

    On Sat, 10 Sep 2005 22:15:33 +1200, Shane wrote:

    >> What's that, stalker?
    >>
    >> Bit hot under the collar, there, turniphead?

    >
    > It appears you are, go have a lie down before you make a dick of yourself
    > *again*


    He sure does.

    > Before you rush off though, why do you call misfit a convict, yet tell
    > Michael George that you yourself have smoked pot and feel its a victemless
    > crime?
    > Are you that low?


    Yes he is. You need to understand the psychology of damaged people like
    him:

    He's basically an insecure spotty little reject. He is trying to build his
    self esteem up by harassing and putting others down. He even INVENTS
    complaints in order to do so.

    He might be tolerated if he actually KNEW what he was talking about. But I
    doubt he'd be tolerated even then.

    Woger has the excuse of being senile. Poor excuse that it is, he is at
    least useful once or twice a year (even a busted watch is right twice a
    day).

    HOG does not have these excuses. He is either deliberately an arrogant,
    ignorant little fucktard hypocrite or he has run out of his Ritalin.

    Either way, ignore him.

    --

    .... Brendan

    #212775 +(3734)- [X]

    Primus521: hey dude the funniest thing happened to me today
    Primus521: im at walmart and this chick is buying a box of tampons and they
    are missing the upc and wont ring up
    Primus521: so the cashier tells his buddy to get a price check on tampax
    Primus521: the dude looks at him and says, "the kind u push in, or the kind
    you hammer in?"
    Primus521: lol
    Primus521: turns out he misheard him
    Primus521: he thought he said thumbtacs
    Primus521: you should have seen the look on the chicks face
    Primus521: omfg
    Primus521: til the day i die
    Primus521: i will never forget it


    Note: All my comments are copyright 10/09/2005 11:13:46 p.m. and are opinion only where not otherwise stated and always "to the best of my recollection". www.computerman.orcon.net.nz.
     
    Brendan, Sep 10, 2005
    #8
  9. Andrew

    H.O.G Guest

    On Sat, 10 Sep 2005 23:30:26 +1200, Brendan <>
    spoke these fine words:

    >On Sat, 10 Sep 2005 22:15:33 +1200, Shane wrote:
    >
    >>> What's that, stalker?
    >>>
    >>> Bit hot under the collar, there, turniphead?

    >>
    >> It appears you are, go have a lie down before you make a dick of yourself
    >> *again*

    >
    >He sure does.
    >
    >> Before you rush off though, why do you call misfit a convict, yet tell
    >> Michael George that you yourself have smoked pot and feel its a victemless
    >> crime?
    >> Are you that low?

    >
    >Yes he is. You need to understand the psychology of damaged people like
    >him:
    >
    >He's basically an insecure spotty little reject. He is trying to build his
    >self esteem up by harassing and putting others down. He even INVENTS
    >complaints in order to do so.
    >
    >He might be tolerated if he actually KNEW what he was talking about. But I
    >doubt he'd be tolerated even then.
    >
    >Woger has the excuse of being senile. Poor excuse that it is, he is at
    >least useful once or twice a year (even a busted watch is right twice a
    >day).
    >
    >HOG does not have these excuses. He is either deliberately an arrogant,
    >ignorant little fucktard hypocrite or he has run out of his Ritalin.
    >
    >Either way, ignore him.


    LOL! Thanks for the comedy, knobby.

    I only "put down" people who abuse me first.
     
    H.O.G, Sep 10, 2005
    #9
  10. Andrew

    Harry Guest

    Andrew wrote:

    > Im sure this is possible, Im just not sure how to do it
    >
    > i have a text file called "list"
    >
    > it contains:
    > bldg_whitehallBuildingAnnex 263341
    > bldg_woolworth 262737
    > Queensboro 248950
    > Williamsburg 248948
    > Brooklyn 255674
    >
    > i also have a script called uid2mov.pl which uses the numbers in the
    > above list to get a directory location relative to the number
    >
    > Ive used this command on the list:
    > cat list | awk '{system (" ~alambert/scripts/uid2mov.pl " $2)}' | awk
    > '{system ("cp " $1" /vol/tempwrangler/andrew/hannah1/")}'


    That is crazy!
    You should just use:

    while read dir num
    do
    mv $dir /vol/tempwrangler/andrew/hannah1/
    done <list

    >
    > which executes:
    > cp
    > /vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    > /vol/tempwrangler/andrew/hannah1/
    > cp
    > /vol/shotsub/Movies/kong/Assets/hybridWoolworth/kong_Assets_hybridWoolworth_Take-4.1k.mov
    > /vol/tempwrangler/andrew/hannah1/
    > cp
    > /vol/shotsub/Movies/kong/Assets/queensboroBridge/kong_Assets_queensboroBridge_Take-3.1k.mov
    > /vol/tempwrangler/andrew/hannah1/
    > cp
    > /vol/shotsub/Movies/kong/Assets/williamsburgBridge/kong_Assets_williamsburgBridge_Take-2.1k.mov
    > /vol/tempwrangler/andrew/hannah1/
    > cp
    > /vol/shotsub/Movies/kong/Assets/brooklynBridge/kong_Assets_brooklynBridge_Take-2.1k.mov
    > /vol/tempwrangler/andrew/hannah1/
    >
    >
    > My question is... how to get a different output, ie putting the numbers
    > from the list into the destination filename:
    > cp
    > /vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    > /vol/tempwrangler/andrew/hannah1/kong_Assets_hybrid_Take-28.1k.263341.mov
    >
    > all Using a single line command
    >
    > from the answer i can probably work out how to make it:
    > cp
    > /vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    > /vol/tempwrangler/andrew/hannah1/kong_Assets_hybrid_Take-28.1k.263341_bldg_whitehallBuildingAnnex.mov
    >
    > note, i already have a script that does all of this, Im just reasonably
    > new to awk and i was wondering what i needed to add to the command to
    > get what i want
    >
    > in fact im new to linux all together, so most commands i dont actually
    > know about


    How about:

    while read item num
    do
    mv /vol/shotsub/Movies/kong/Assets/williamsburgBridge/kong_Assets_$item-* /vol/tempwrangler/andrew/hannah1/
    done <list

    Or something like that.
    It really is simple, so you should keep it simple.
     
    Harry, Sep 10, 2005
    #10
  11. Andrew

    Andrew Guest

    Harry wrote:
    > Andrew wrote:
    >
    >
    >>Im sure this is possible, Im just not sure how to do it
    >>
    >>i have a text file called "list"
    >>
    >>it contains:
    >>bldg_whitehallBuildingAnnex 263341
    >>bldg_woolworth 262737
    >>Queensboro 248950
    >>Williamsburg 248948
    >>Brooklyn 255674
    >>
    >>i also have a script called uid2mov.pl which uses the numbers in the
    >>above list to get a directory location relative to the number
    >>
    >>Ive used this command on the list:
    >>cat list | awk '{system (" ~alambert/scripts/uid2mov.pl " $2)}' | awk
    >>'{system ("cp " $1" /vol/tempwrangler/andrew/hannah1/")}'

    >
    >
    > That is crazy!
    > You should just use:
    >
    > while read dir num
    > do
    > mv $dir /vol/tempwrangler/andrew/hannah1/
    > done <list
    >
    >
    >>which executes:
    >>cp
    >>/vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    >>/vol/tempwrangler/andrew/hannah1/
    >>cp
    >>/vol/shotsub/Movies/kong/Assets/hybridWoolworth/kong_Assets_hybridWoolworth_Take-4.1k.mov
    >>/vol/tempwrangler/andrew/hannah1/
    >>cp
    >>/vol/shotsub/Movies/kong/Assets/queensboroBridge/kong_Assets_queensboroBridge_Take-3.1k.mov
    >>/vol/tempwrangler/andrew/hannah1/
    >>cp
    >>/vol/shotsub/Movies/kong/Assets/williamsburgBridge/kong_Assets_williamsburgBridge_Take-2.1k.mov
    >>/vol/tempwrangler/andrew/hannah1/
    >>cp
    >>/vol/shotsub/Movies/kong/Assets/brooklynBridge/kong_Assets_brooklynBridge_Take-2.1k.mov
    >>/vol/tempwrangler/andrew/hannah1/
    >>
    >>
    >>My question is... how to get a different output, ie putting the numbers
    >>from the list into the destination filename:
    >>cp
    >>/vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    >>/vol/tempwrangler/andrew/hannah1/kong_Assets_hybrid_Take-28.1k.263341.mov
    >>
    >>all Using a single line command
    >>
    >>from the answer i can probably work out how to make it:
    >>cp
    >>/vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    >>/vol/tempwrangler/andrew/hannah1/kong_Assets_hybrid_Take-28.1k.263341_bldg_whitehallBuildingAnnex.mov
    >>
    >>note, i already have a script that does all of this, Im just reasonably
    >>new to awk and i was wondering what i needed to add to the command to
    >>get what i want
    >>
    >>in fact im new to linux all together, so most commands i dont actually
    >>know about

    >
    >
    > How about:
    >
    > while read item num
    > do
    > mv /vol/shotsub/Movies/kong/Assets/williamsburgBridge/kong_Assets_$item-* /vol/tempwrangler/andrew/hannah1/
    > done <list
    >
    > Or something like that.
    > It really is simple, so you should keep it simple.
    >

    Im unable to do this as i need to use the script -
    alambert/scripts/uid2mov.pl with the 6 digit number in order to resolve
    the location of the .mov file

    So essentially first i need to run uid2mov.pl <number> to get the
    /vol/shotsub/Movies/kong/Asse.... etc and i then need to attach that
    same number and posisbly its description from the original list
     
    Andrew, Sep 10, 2005
    #11
  12. Andrew

    Andrew Guest

    Lawrence D¹Oliveiro wrote:
    > In article <2UqUe.10274$>,
    > Andrew <> wrote:
    >
    >
    >>Im sure this is possible, Im just not sure how to do it
    >>
    >>i have a text file called "list"
    >>
    >>it contains:
    >>bldg_whitehallBuildingAnnex 263341
    >>bldg_woolworth 262737
    >>Queensboro 248950
    >>Williamsburg 248948
    >>Brooklyn 255674
    >>
    >>i also have a script called uid2mov.pl which uses the numbers in the
    >>above list to get a directory location relative to the number
    >>
    >>Ive used this command on the list:
    >>cat list | awk '{system (" ~alambert/scripts/uid2mov.pl " $2)}' | awk
    >>'{system ("cp " $1" /vol/tempwrangler/andrew/hannah1/")}'

    >
    >
    > I don't think I would bother with awk for this. bash should be powerful
    > enough for the job.
    >
    > First of all, you should be able to separate out the lines of the file
    > as follows:
    >
    > SAVEIFS="$IFS"; IFS=$'\n'
    > declare -a lines; lines=($(< list))
    > IFS="$SAVEIFS"
    >
    > Then you can iterate over the entries something like:
    >
    > for ((i=0; i < ${#lines[*]}; ++i))
    > do
    > parms=(${lines[$i]})
    > cp $(~alambert/scripts/uid2mov.pl ${parms[1]}) \
    > /vol/tempwrangler/andrew/hannah1/kong_Assets_ ${parms[1]}.
    > ${parms[0]}.mov
    > done
    >
    > (Haven't tested this!) Not sure if that gives exactly the file names you
    > want, though.
    >
    > If you want more complex construction of destination filenames from
    > source ones, I would recommend using a Perl script.

    Yup, i realise this, i have a perl script already to do this

    my intention with this post is to see if awk or something else could do
    it - single lined command line - okay a long line at that
     
    Andrew, Sep 10, 2005
    #12
  13. Andrew

    Andrew Guest

    Shane wrote:
    > On Sat, 10 Sep 2005 13:44:30 +1200, Andrew wrote:
    > Hi andrew,
    > What you want is to add regular expressions into your awk statements,
    > specifically you are looking at
    > awk ' {sub(/$/,"$2")}'
    >
    > http://www.student.northpark.edu/pemente/awk/awk1line.txt
    >
    > Im not too handy with awk at all (in fact I got the above from google)
    > the substitution means as follows
    > sub <<-- no prizes here
    > /$/ <<-- at the end of the line
    > "$2" <<-- Im guessing you can pass $2 (which contains the info you want
    > added to the end of the line)
    >
    > Also Im not sure if you want everyone to know your full name and place of
    > work (although working in mirimar is something to be proud of indeed;-)
    > so a bit of judicious snipping might be in order in future
    > HTH
    >
    >



    Cheers, I will take a look and see if it does what i need

    I cant say im too fussed about the information contained.. as its
    nothing universal will jump up and down about :)

    Plus - after we are done here who knows where i will be!
     
    Andrew, Sep 10, 2005
    #13
  14. Andrew

    daemon9 Guest

    On Sat, 10 Sep 2005 23:57:07 +1200, H.O.G wrote:

    > On Sat, 10 Sep 2005 23:30:26 +1200, Brendan <>
    > spoke these fine words:
    >
    >>On Sat, 10 Sep 2005 22:15:33 +1200, Shane wrote:
    >>
    >>>> What's that, stalker?
    >>>>
    >>>> Bit hot under the collar, there, turniphead?
    >>>
    >>> It appears you are, go have a lie down before you make a dick of yourself
    >>> *again*

    >>
    >>He sure does.
    >>
    >>> Before you rush off though, why do you call misfit a convict, yet tell
    >>> Michael George that you yourself have smoked pot and feel its a victemless
    >>> crime?
    >>> Are you that low?

    >>
    >>Yes he is. You need to understand the psychology of damaged people like
    >>him:
    >>
    >>He's basically an insecure spotty little reject. He is trying to build his
    >>self esteem up by harassing and putting others down. He even INVENTS
    >>complaints in order to do so.
    >>
    >>He might be tolerated if he actually KNEW what he was talking about. But I
    >>doubt he'd be tolerated even then.
    >>
    >>Woger has the excuse of being senile. Poor excuse that it is, he is at
    >>least useful once or twice a year (even a busted watch is right twice a
    >>day).
    >>
    >>HOG does not have these excuses. He is either deliberately an arrogant,
    >>ignorant little fucktard hypocrite or he has run out of his Ritalin.
    >>
    >>Either way, ignore him.

    >
    > LOL! Thanks for the comedy, knobby.
    >
    > I only "put down" people who abuse me first.


    So why arn't you fighting back you a spineless wuss?

    d9
     
    daemon9, Sep 11, 2005
    #14
  15. Andrew

    Harry Guest

    Andrew wrote:

    > Harry wrote:
    >> Andrew wrote:
    >>
    >>
    >>>Im sure this is possible, Im just not sure how to do it
    >>>
    >>>i have a text file called "list"
    >>>
    >>>it contains:
    >>>bldg_whitehallBuildingAnnex 263341
    >>>bldg_woolworth 262737
    >>>Queensboro 248950
    >>>Williamsburg 248948
    >>>Brooklyn 255674
    >>>
    >>>i also have a script called uid2mov.pl which uses the numbers in the
    >>>above list to get a directory location relative to the number
    >>>
    >>>Ive used this command on the list:
    >>>cat list | awk '{system (" ~alambert/scripts/uid2mov.pl " $2)}' | awk
    >>>'{system ("cp " $1" /vol/tempwrangler/andrew/hannah1/")}'

    >>
    >>
    >> That is crazy!
    >> You should just use:
    >>
    >> while read dir num
    >> do
    >> mv $dir /vol/tempwrangler/andrew/hannah1/
    >> done <list
    >>
    >>
    >>>which executes:
    >>>cp
    >>>/vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    >>>/vol/tempwrangler/andrew/hannah1/
    >>>cp
    >>>/vol/shotsub/Movies/kong/Assets/hybridWoolworth/kong_Assets_hybridWoolworth_Take-4.1k.mov
    >>>/vol/tempwrangler/andrew/hannah1/
    >>>cp
    >>>/vol/shotsub/Movies/kong/Assets/queensboroBridge/kong_Assets_queensboroBridge_Take-3.1k.mov
    >>>/vol/tempwrangler/andrew/hannah1/
    >>>cp
    >>>/vol/shotsub/Movies/kong/Assets/williamsburgBridge/kong_Assets_williamsburgBridge_Take-2.1k.mov
    >>>/vol/tempwrangler/andrew/hannah1/
    >>>cp
    >>>/vol/shotsub/Movies/kong/Assets/brooklynBridge/kong_Assets_brooklynBridge_Take-2.1k.mov
    >>>/vol/tempwrangler/andrew/hannah1/
    >>>
    >>>
    >>>My question is... how to get a different output, ie putting the numbers
    >>>from the list into the destination filename:
    >>>cp
    >>>/vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    >>>/vol/tempwrangler/andrew/hannah1/kong_Assets_hybrid_Take-28.1k.263341.mov
    >>>
    >>>all Using a single line command
    >>>
    >>>from the answer i can probably work out how to make it:
    >>>cp
    >>>/vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    >>>/vol/tempwrangler/andrew/hannah1/kong_Assets_hybrid_Take-28.1k.263341_bldg_whitehallBuildingAnnex.mov
    >>>
    >>>note, i already have a script that does all of this, Im just reasonably
    >>>new to awk and i was wondering what i needed to add to the command to
    >>>get what i want
    >>>
    >>>in fact im new to linux all together, so most commands i dont actually
    >>>know about

    >>
    >>
    >> How about:
    >>
    >> while read item num
    >> do
    >> mv
    >> /vol/shotsub/Movies/kong/Assets/williamsburgBridge/kong_Assets_$item-*
    >> /vol/tempwrangler/andrew/hannah1/
    >> done <list
    >>
    >> Or something like that.
    >> It really is simple, so you should keep it simple.
    >>

    > Im unable to do this as i need to use the script -
    > alambert/scripts/uid2mov.pl with the 6 digit number in order to resolve
    > the location of the .mov file
    >
    > So essentially first i need to run uid2mov.pl <number> to get the
    > /vol/shotsub/Movies/kong/Asse.... etc and i then need to attach that
    > same number and posisbly its description from the original list


    You need to use your brains.

    Try something like this:

    while read item num
    do
    file=`uid2mov.pl $num`
    mv $file /vol/tempwrangler/andrew/hannah1/$file-$num
    done <list

    I suggest you try "man bash" and read very carefully.
    Also, look in /usr/share/doc/bash-N.NN/scripts etc where you will
    find lots of examples.
     
    Harry, Sep 11, 2005
    #15
  16. Andrew

    Andrew Guest

    Harry wrote:
    > Andrew wrote:
    >
    >
    >>Harry wrote:
    >>
    >>>Andrew wrote:
    >>>
    >>>
    >>>
    >>>>Im sure this is possible, Im just not sure how to do it
    >>>>
    >>>>i have a text file called "list"
    >>>>
    >>>>it contains:
    >>>>bldg_whitehallBuildingAnnex 263341
    >>>>bldg_woolworth 262737
    >>>>Queensboro 248950
    >>>>Williamsburg 248948
    >>>>Brooklyn 255674
    >>>>
    >>>>i also have a script called uid2mov.pl which uses the numbers in the
    >>>>above list to get a directory location relative to the number
    >>>>
    >>>>Ive used this command on the list:
    >>>>cat list | awk '{system (" ~alambert/scripts/uid2mov.pl " $2)}' | awk
    >>>>'{system ("cp " $1" /vol/tempwrangler/andrew/hannah1/")}'
    >>>
    >>>
    >>>That is crazy!
    >>>You should just use:
    >>>
    >>> while read dir num
    >>> do
    >>> mv $dir /vol/tempwrangler/andrew/hannah1/
    >>> done <list
    >>>
    >>>
    >>>
    >>>>which executes:
    >>>>cp
    >>>>/vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    >>>>/vol/tempwrangler/andrew/hannah1/
    >>>>cp
    >>>>/vol/shotsub/Movies/kong/Assets/hybridWoolworth/kong_Assets_hybridWoolworth_Take-4.1k.mov
    >>>>/vol/tempwrangler/andrew/hannah1/
    >>>>cp
    >>>>/vol/shotsub/Movies/kong/Assets/queensboroBridge/kong_Assets_queensboroBridge_Take-3.1k.mov
    >>>>/vol/tempwrangler/andrew/hannah1/
    >>>>cp
    >>>>/vol/shotsub/Movies/kong/Assets/williamsburgBridge/kong_Assets_williamsburgBridge_Take-2.1k.mov
    >>>>/vol/tempwrangler/andrew/hannah1/
    >>>>cp
    >>>>/vol/shotsub/Movies/kong/Assets/brooklynBridge/kong_Assets_brooklynBridge_Take-2.1k.mov
    >>>>/vol/tempwrangler/andrew/hannah1/
    >>>>
    >>>>
    >>>>My question is... how to get a different output, ie putting the numbers
    >>>
    >>>>from the list into the destination filename:
    >>>
    >>>>cp
    >>>>/vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    >>>>/vol/tempwrangler/andrew/hannah1/kong_Assets_hybrid_Take-28.1k.263341.mov
    >>>>
    >>>>all Using a single line command
    >>>>
    >>>
    >>>>from the answer i can probably work out how to make it:
    >>>
    >>>>cp
    >>>>/vol/shotsub/Movies/kong/Assets/hybrid/kong_Assets_hybrid_Take-28.1k.mov
    >>>>/vol/tempwrangler/andrew/hannah1/kong_Assets_hybrid_Take-28.1k.263341_bldg_whitehallBuildingAnnex.mov
    >>>>
    >>>>note, i already have a script that does all of this, Im just reasonably
    >>>>new to awk and i was wondering what i needed to add to the command to
    >>>>get what i want
    >>>>
    >>>>in fact im new to linux all together, so most commands i dont actually
    >>>>know about
    >>>
    >>>
    >>>How about:
    >>>
    >>> while read item num
    >>> do
    >>> mv
    >>> /vol/shotsub/Movies/kong/Assets/williamsburgBridge/kong_Assets_$item-*
    >>> /vol/tempwrangler/andrew/hannah1/
    >>> done <list
    >>>
    >>>Or something like that.
    >>>It really is simple, so you should keep it simple.
    >>>

    >>
    >>Im unable to do this as i need to use the script -
    >>alambert/scripts/uid2mov.pl with the 6 digit number in order to resolve
    >>the location of the .mov file
    >>
    >>So essentially first i need to run uid2mov.pl <number> to get the
    >>/vol/shotsub/Movies/kong/Asse.... etc and i then need to attach that
    >>same number and posisbly its description from the original list

    >
    >
    > You need to use your brains.
    >
    > Try something like this:
    >
    > while read item num
    > do
    > file=`uid2mov.pl $num`
    > mv $file /vol/tempwrangler/andrew/hannah1/$file-$num
    > done <list
    >
    > I suggest you try "man bash" and read very carefully.
    > Also, look in /usr/share/doc/bash-N.NN/scripts etc where you will
    > find lots of examples.
    >

    Im unsure if you have actually read what i asked.. and also mentioned in
    other posts, but im looking for a one line solution. i already have a
    working perl script that does exactly what i want to do.. In fact i dont
    need to do this particular job anymore as its done

    Im just curious about awk and a single command line solution, or maybe
    not even awk, There could be some other smart linux command that can
    help me achieve what im after
     
    Andrew, Sep 11, 2005
    #16
  17. Andrew

    H.O.G Guest

    On Sun, 11 Sep 2005 13:47:28 +1200, daemon9 <> spoke
    these fine words:
    >>>
    >>>>> What's that, stalker?
    >>>>>
    >>>>> Bit hot under the collar, there, turniphead?
    >>>>
    >>>> It appears you are, go have a lie down before you make a dick of yourself
    >>>> *again*
    >>>
    >>>He sure does.
    >>>
    >>>> Before you rush off though, why do you call misfit a convict, yet tell
    >>>> Michael George that you yourself have smoked pot and feel its a victemless
    >>>> crime?
    >>>> Are you that low?
    >>>
    >>>Yes he is. You need to understand the psychology of damaged people like
    >>>him:
    >>>
    >>>He's basically an insecure spotty little reject. He is trying to build his
    >>>self esteem up by harassing and putting others down. He even INVENTS
    >>>complaints in order to do so.
    >>>
    >>>He might be tolerated if he actually KNEW what he was talking about. But I
    >>>doubt he'd be tolerated even then.
    >>>
    >>>Woger has the excuse of being senile. Poor excuse that it is, he is at
    >>>least useful once or twice a year (even a busted watch is right twice a
    >>>day).
    >>>
    >>>HOG does not have these excuses. He is either deliberately an arrogant,
    >>>ignorant little fucktard hypocrite or he has run out of his Ritalin.
    >>>
    >>>Either way, ignore him.

    >>
    >> LOL! Thanks for the comedy, knobby.
    >>
    >> I only "put down" people who abuse me first.

    >
    >So why arn't you fighting back you a spineless wuss?
    >
    >d9


    Because, unlike morons like Shane and Brendan, I don't think nz.comp
    is the appropriate place for flame wars.

    And Brendan's post is just too pathetic to even bother wasting my time
    on.
     
    H.O.G, Sep 11, 2005
    #17
  18. Andrew

    Shane Guest

    Shane, Sep 11, 2005
    #18
  19. Andrew

    H.O.G Guest

    H.O.G, Sep 11, 2005
    #19
  20. Andrew

    Shane Guest

    On Sun, 11 Sep 2005 17:56:07 +1200, H.O.G wrote:

    > On Sun, 11 Sep 2005 16:59:42 +1200, Shane <-a-geek.net>
    > spoke these fine words:
    >
    >>On Sun, 11 Sep 2005 16:46:12 +1200, H.O.G wrote:
    >>
    >>> Because, unlike morons like Shane and Brendan, I don't think nz.comp is
    >>> the appropriate place for flame wars.

    >>
    >>Well that explains this post
    >>
    >>http://groups.google.co.nz/groups?a...81&as_maxd=11&as_maxm=9&as_maxy=2005&safe=off
    >>http://tinyurl.com/cv2j6

    >
    > Hi, Stalker. That was a comment, not a flamewar.
    >
    > Buy a dictionary, turniphead.


    http://en.wikipedia.org/wiki/Flaming
    --
    Hardware, n.: The parts of a computer system that can be kicked

    The best way to get the right answer on usenet is to post the wrong one.
     
    Shane, Sep 11, 2005
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ralph Wade Phillips

    Re: Pretty Please Peer2Peer need help Pretty Please

    Ralph Wade Phillips, Jul 6, 2003, in forum: Computer Support
    Replies:
    0
    Views:
    567
    Ralph Wade Phillips
    Jul 6, 2003
  2. John Haithwaite @ Blue Case Solutions

    Re: Pretty Please Peer2Peer need help Pretty Please

    John Haithwaite @ Blue Case Solutions, Jul 6, 2003, in forum: Computer Support
    Replies:
    0
    Views:
    613
    John Haithwaite @ Blue Case Solutions
    Jul 6, 2003
  3. Doc Martian
    Replies:
    2
    Views:
    724
    Larry G
    Mar 23, 2006
  4. Harvey

    Re: One more Pretty Face - Pretty face9.jpg [1/1]

    Harvey, Nov 3, 2004, in forum: Digital Photography
    Replies:
    7
    Views:
    467
    Pepys
    Nov 4, 2004
  5. Replies:
    1
    Views:
    576
    Pete D
    Dec 23, 2004
Loading...

Share This Page