LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problems trying to extract gzipped archives from script (https://www.linuxquestions.org/questions/linux-newbie-8/problems-trying-to-extract-gzipped-archives-from-script-4175451709/)

ankitarajdev 02-25-2013 11:11 PM

Problems trying to extract gzipped archives from script
 
ose.tar.gz: command not found
build.tar.gz: command not found
how to overcome this error? I am totally new to linux.

chrism01 02-25-2013 11:34 PM

Those are data files, not cmds.
What exactly are you trying to do?

You should read this
http://rute.2038bug.com/index.html.gz

Can you tells us the name of your Linux version?
Please post the results of
Code:

cat /etc/*release*

uname -a

df -h


shivaa 02-26-2013 12:18 AM

These are archived files (or a collection of zipped files). Tar stands for tape archive and gz for gzip.
These files were created as:
Code:

~$ tar -cvf ose.tar /path/to/source
~$ gzip ose.tar

So in order to check it's content, use:
Code:

~$ tar -ztvf ose.tar.gz
To open/extract it:
Code:

~$ tar -zxvf ose.tar.gz
OR
~$ gunzip ose.tar.gz
~$ tar -xvf ose.tar


ankitarajdev 03-04-2013 11:41 PM

Thanku
 
Thanku for the reply

I have another problem. I am totally new to linux. I have been given one document and in that the paths are like this i.e./home/cdot/c4/ose. My mam has asked me to replace the path i.e. /home/cdot/ with some variable. How could I do this?

Thanku

fortran 03-04-2013 11:55 PM

Code:

$ var=/home/cdot
where var is a variable, it could be anything.
if you call the variable using echo, the output is what you have stored in the variable, right now it is path.
Code:

$ echo $var
output
Code:

/home/cdot
You can use $var instead of /home/cdot in your script

ankitarajdev 03-05-2013 12:11 AM

Thanku
 
Thanku for the reply but still its not working.
Here is the error which i am getting.
./script: line 11: /home/cdot/c4/ose/site: is a directory
./script: line 12: /home/cdot/c4/ACE_wrappers/TAO: is a directory
./script: line 13: =/home/cdot: No such file or directory
[root@hpv2k-57 c4]# pwd
/home/cdot/c4
Thanku

shivaa 03-05-2013 12:22 AM

Do you want to replace /home/cdot/ string with some variable...?

Code:

~$ sed -e 's/\/home\/cdot/<some_value>/g' infile.txt
OR
~$ gawk '{gsub(/\/home\/cdot\//,"<some_value>",$0); print $0}' infile.txt

Where, <some_value> is what you will replace /home/cdot with.

chrism01 03-05-2013 12:26 AM

Probably best if you show us the script and be clear on what you want to see before and after.

ankitarajdev 03-05-2013 12:26 AM

I have been given one code and I have been asked to grep /home/cdot/c4 path in the code. Some where in the Makefiles this path is hardcoded. I have to find those paths and document it. Then I
have to replace those path with the variable where one can specify the path from my
script. I am unable to do dis.

I have found the path and it is
OSE_ROOT=/home/cdot/c4/ose and the other path is
export OTCommon_ROOT=home/cdot/c4/core/common

I have to replace only home/cdot with the variable.
Thanku

ankitarajdev 03-05-2013 02:41 AM

Thanku chris
This is the kind of script. Its not the exact script
My mam has asked me to search for the path /home/cdot/c4 nd replace /home/cdot with some variable so that it could be assessed by that variable instead of the directory.
export ROOT=`pwd`
export ACE_ROOT=$ROOT/ACE_wrappers
export LD_LIBRARY_PATH=$ACE_ROOT/lib
export TAO_ROOT=$ACE_ROOT/TAO
export PATH=$PATH:/$ROOT/build
gunzip ose.tar.gz
tar -xvf ose.tar
cd $ROOT/ACE_wrappers/ace
ln -s config-linux.h config.h
cd $ROOT/ACE_wrappers/include/makeinclude
ln -s platform_linux.GNU platform_macros.GNU

cd $ROOT/dc/jobs/unix
chmod +x bldsixax
./bldsixax release

mkdir $ROOT/core/UCA/release/lib
mkdir $ROOT/core/UCA/release/lib/i686-pc-linux_dbg.GNU3_4_4
$ROOT/core/OpenSDF/SDF/SDF_SchemaCompiler/src/SDF_Schema.cc
cd $ROOT/core/OpenSDF
export INSTALL_ROOT=$ROOT/core/OpenSDF
export PROJECT_PATH=$ROOT/core/OpenSDF

cd $ROOT/core/Common
cd $ROOT/core/CASGCommon
export INSTALL_ROOT=$ROOT/core/CASGCommon
ln -s dotproject.project
cd $ROOT/core/UCA
export INSTALL_ROOT=$ROOT/core/UCA
ln -s dotproject.project
grep /home/cdot/c4

---------- Post added 03-05-13 at 02:12 PM ----------

Thanku shivaa

shivaa 03-05-2013 03:15 AM

No need to use any other variable. The $HOME in-build variable is enough to hold /home/cdot directory.

Else you can do following in your script:
Code:

VAR="/home/cdot/c4"
Then you can use this, as:
Code:

cat $VAR/foo.txt
OR
cd $VAR/bar

To make changes in your script, once invoke:
Code:

~$ gawk '{gsub(/\/home\/cdot\/c4/,"\$VAR",$0); print $0}' myscript.sh

ankitarajdev 03-05-2013 11:58 PM

Can you please suggest me some link or book for studying an practicing the scripts..
Thanku

shivaa 03-06-2013 12:08 AM

Best reference books are here.

Please Mark the thread as solved, if you think it has so (option is under Thread Tools on top menu).

chrism01 03-06-2013 01:30 AM

See also
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html

ankitarajdev 03-13-2013 12:28 AM

problem while replacing a directory with the variable
 
There are some scripts made in the path root/c4/build and in that scripts we have used the path /home/cdot/c4. So i want to replace /home/cdot path with some variable. Rightnow I am acccessing my scripts from root/c4. I want to write a script in root so dat in the scripts, home/cdot path gets replaced with that variable. How can I do that?

Thanku.


All times are GMT -5. The time now is 06:15 PM.