UNIX\LINUX: How to add a directory text to each line inside a file?
NOTE: I am just using shell(CMD TOOL OF LINUX REDHAT EPIC) no other...
You see I have many log files(.txt.gz) and I was able to open all of them just by using:
foreach i (./*/*dumpfiles.txt.gz_*)
> foreach? zcat $i
> foreach? grep "-e" $i
> foreach? END
Meaning I am going through all those folders finding a file dumpfiles.txt.gz_
The the output is like:
0x4899252 move x -999
0x4899231 move y -0
0x4899222 find scribe
0x4899231 move x -999
etc..
The problem is that I need the directory to be set to each line of the file... I could get the directory by the command pwd.
The question to my problem is how to add a directory name on each line of the file? Example:
(directory) (per line of all files)
machine01 0x4899252 move x -999
machine01 0x4899231 move y -0
machine09 0x4899222 find scribe
machine09 0x4899231 move x -999
etc..
I tried using $ sed but I cant find the solution... :(
Thanks...