renaming a compressed file to filename without .Z


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers renaming a compressed file to filename without .Z
# 8  
Old 08-16-2005
The variable 1 I am referring to is the positional parameter.

Look at the man pages of ksh.

Under the Paramter sub-heading.

Code:
       The  following  special  parameters are implicitly set by the shell and
       cannot be set directly using assignments:

       !      Process id of the last background process started.  If no  back-
              ground processes have been started, the parameter is not set.

       #      The number of positional parameters (i.e., $1, $2, etc.).

       $      The process ID of the shell, or the PID of the original shell if
              it is a subshell.

       -      The concatenation of the current single letter options (see  set
              command below for list of options).

       ?      The  exit  status of the last non-asynchronous command executed.
              If the last command was killed by a signal, $?  is  set  to  128
              plus the signal number.

       0      The name the shell was invoked with (i.e., argv[0]), or the com-
              mand-name if it was invoked with the -c option and the  command-
              name was supplied, or the file argument, if it was supplied.  If
              the posix option is not set, $0 is the name of the current func-
              tion or script.

       1 ... 9
              The  first  nine positional parameters that were supplied to the
              shell, function or .-script.  Further positional parameters  may
              be accessed using ${number}.

       *      All  positional  parameters  (except  parameter  0), i.e., $1 $2
              $3....  If used outside of double quotes, parameters  are  sepa-
              rate  words  (which  are  subjected  to word splitting); if used
              within double quotes, parameters  are  separated  by  the  first
              character  of  the  IFS parameter (or the empty string if IFS is
              null).

       @      Same as $*, unless it is used inside  double  quotes,  in  which
              case  a separate word is generated for each positional parameter
              - if there are no positional parameters, no  word  is  generated
              ("$@" can be used to access arguments, verbatim, without loosing
              null arguments or splitting arguments with spaces).

From man sh

Code:
   Positional Parameters
       A  positional  parameter  is a parameter denoted by one or more digits,
       other than the single digit 0.  Positional parameters are assigned from
       the  shell?s  arguments when it is invoked, and may be reassigned using
       the set builtin command.  Positional parameters may not be assigned  to
       with  assignment statements.  The positional parameters are temporarily
       replaced when a shell function is executed (see FUNCTIONS below).


vino
# 9  
Old 08-16-2005
You can replace the positional parameters with set

e.g.
Code:
$ cat ./foo.ksh
#!/bin/ksh

echo "$1 $2"
set -- "something" "something_else"
echo "$1 $2"

exit 0
$./foo.ksh foo bar
foo bar
something something_else
$

Cheers
ZB
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Renaming files by appending string from within file to filename

Greetings. I am working in a Linux environment and am trying to figure out a way to rename files in a directory by appending a unique strings that appears within a certain area in those files. I have gotten as far as identifying what that particular unique string is with a command like the... (10 Replies)
Discussion started by: HLee1981
10 Replies

2. Shell Programming and Scripting

Renaming multiple files at once (discarding suffix of the filename after a character)

Hi, I have a lot of files similar to the below order. I want to rename all the files .discrading the time stamp/numbers after cnf. Existing files id_info_20130405.cnf_20130801 in_info_20130405.cnf_20130891 iz_info_20130405.cnf_20130821 in_info_20130405.cnf_20130818... (2 Replies)
Discussion started by: saravanapandi
2 Replies

3. Shell Programming and Scripting

Search compressed files with awk and get FILENAME

I have many compressed files I want to search using awk and want to print some file contents along with the filename it came from on each output record (I simplified awk command). Here are the results with the files uncompressed: awk '{print FILENAME, $0}' test*.txt test1.txt from test1... (3 Replies)
Discussion started by: mjf
3 Replies

4. Shell Programming and Scripting

Renaming file that has multiple numbers as filename

Hi I have a file with filename as "partition-setup-and-ipl.vtcmd.76217657132.9721536798" Now i need to move this file as "partition-setup-and-ipl.vtcmd.76217657132.9721536798_org" i tried with # ls | grep -E "partition-setup-and-ipl.vtcmd.+"... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

5. Shell Programming and Scripting

Renaming a filename

Hi friends , i want to change the filename as below filename=ABC_HYND_JDHD_20130125120345.txt expected output : ABC_HYND_JDHD_20130125.txt i have tried using awk but not able to procedd futher. i am trying to do the above in single commad. echo... (3 Replies)
Discussion started by: i150371485
3 Replies

6. Shell Programming and Scripting

Renaming the filename

Hi, I have several files with name b1.root, b2.root b3.root I want to rename the "b" to "bkg", so finally is should be: bkg1.root bkg2.root bkg3.root I used command: rename s/b/bsig/ b*root Somehow it is working at some place and not working in other folder. I do not have any idea... (3 Replies)
Discussion started by: nrjrasaxena
3 Replies

7. Shell Programming and Scripting

BASH Batch renaming insert additional zero into filename

Hi all, Wondering how this could be accomplished........ a directory contains sequentially numbered files from fw01 to fw999. How would I insert an additional zero so that the directory lists these files in a proper manner? (i.e. all double digit files from fw01 to fw99 would become... (3 Replies)
Discussion started by: putter1900
3 Replies

8. Shell Programming and Scripting

compressed file

i have a file 4d7a94d0.bbb.1292 when i do file 4d7a94d0.bbb.1292 the ouput is below 4d7a94d0.bbb.1292: gzip compressed data - deflate method and i run this command gunzip -c 4d7a94d0.bbb.1292 | awk '{gsub("\"","")}/I_ACCOUNT_ID/{print $2}' RS=":|;" FS="," i get... (3 Replies)
Discussion started by: blackzinga80
3 Replies

9. UNIX for Dummies Questions & Answers

compressed file

I compressed a file by using gzip command gzip <<xx>> filename changed to xx.gz How to view this xx.gz file. Any idea. Thanks in advance. (7 Replies)
Discussion started by: venkatesht
7 Replies

10. UNIX for Dummies Questions & Answers

Renaming files to have date/time in filename

I have a program that will export my data to a single file, but it assigns a file name that is overridden every time I run the program. I need to change the file name to have a sequential number in the filename. How do I rename a file so that the filename contains the system date and time. I want... (5 Replies)
Discussion started by: wayneb
5 Replies
Login or Register to Ask a Question