bash - Linux shell script to copy last lines of a file in a directory to append to a file in another directory -


To copy the last lines of a directory file, add the following shell script to the file in another directory. wrote

  cd / opt / grinder / SVN / IAVS / GrinderLogs / GrinderBaseLogs / Lg2Logs GrinderLG1 = 'rm101sys1lweb22' GrinderLg2 = 'rm101sys1lweb23' fileCount = $ (ls -l | WC -l) echo $ fileCount ((c = 0; c & lt; = $ fileCount-2; c ++)) rows = $ (over $ Graindergah 2 "-" $ c "-data.log" | wc -l) Line 1 = `Exprod $ Lines - 1` `" Tail - "$ Lines1" f / opt / grinder / svn / I AVS / Grinderlogs / Grinderbselogs / Lg2Logs / "$ Grinderlg2" - "$ a" -detaklog & gt; & gt; / opt / grinder / Swn / Iavs / Grinderlogs / Grinderbselogs / "$ Grinderlgl" - "$ a" -detaklog "` #exec $ command '  

When I am executing this script it says that there is no directory on the tail or the tail. Basically both files are present please help.

  tail - "$ rows 1" f / opt / grinder / svn / IAVS / Grinderlogs / Grinderbselogs / Lg2Logs / "$ Grinderlg2" - "$ a" -detaklog & gt; & gt; / opt / grinder / Swn / Iavs / Grinderlogs / Grinderbselogs / "$ Grinderlgl" - "$ a" Data. Log "`   

  change the tail - "" f / opt / grinder / SVN / IAVS / GrinderLogs / GrinderBaseLogs / Lg2Logs / "$ Lines1 $ GrinderLg2 "-" $ c "-data.log & gt; & gt; / opt / grinder / SVN / IAVS / GrinderLogs / GrinderBaseLogs /" $ GrinderLG1 "-" $ c "-data.log  < / Pre> 

should work.


In my setup I have tested the following way

  #! / Bin / sh` "tail-  

/ Code>

This works fine.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -