Sponsored Content
Top Forums Shell Programming and Scripting Rename file from data in file Post 302405759 by octupos on Friday 19th of March 2010 10:38:36 PM
Old 03-19-2010
Yeap the string[9-16] in the top of the line. And no it doesn't need to be grepped.
My apologies.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help with multiple file rename - change case of part of file name

Hi there, I hope someone can help me with this problem : I have a directory (/var/www/file/imgprofil) which contains about 10000 JPG files. They have a naming convention thus : prefix-date-key-suffix.jpg they all have the prefix p-20050608- then AAAA is a 4 letter code the suffix is... (7 Replies)
Discussion started by: steve7
7 Replies

2. UNIX for Dummies Questions & Answers

Rename file based on first 3 characters of data in file

I'm looking to determine if I can use a grep command to read file and rename the file based on the first 3 characters of the data in the file. An example is: Read FileA If the first 3 positions of the data in the file are "ITP", then rename the file as FileA_ITP, else if the first 3... (3 Replies)
Discussion started by: jchappel
3 Replies

3. Shell Programming and Scripting

A script that will move a file to a directory with the same name and then rename that file

Hello all. I am new to this forum (and somewhat new to UNIX / LINUX - I started using ubuntu 1 year ago).:b: I have the following problem that I have not been able to figure out how to take care of and I was wondering if anyone could help me out.:confused: I have all of my music stored in... (7 Replies)
Discussion started by: marcozd
7 Replies

4. Shell Programming and Scripting

.sh file To rename existing file and copy new file

Hi All, I am very new to shell scripting . In my current task i want to create .sh file that will rename the existing file with appending _bu in it. And then copy new file . e.g if i have file linuxFirst.java then i want to rename it to linuxFirst_bu.java ..Then want replace with latest... (1 Reply)
Discussion started by: maheshkaranjkar
1 Replies

5. UNIX for Dummies Questions & Answers

look for specific values in a file and rename file with value found

Hi, i have a file with some data ..look for some specific value in the file and if found that value rename the file with the value found in the file.. ex.. File.txt 1236 43715825601ANDERSSON, 1236 437158256031963040120060901200609010000000 1236 43715825604123 MCCL AVE UPPER 1236 ... (11 Replies)
Discussion started by: dssyadav
11 Replies

6. UNIX for Dummies Questions & Answers

Mapping a data in a file and delete line in source file if data does not exist.

Hi Guys, Please help me with my problem here: I have a source file: 1212 23232 343434 ASAS1 4 3212 23232 343434 ASAS2 4 3234 23232 343434 QWQW1 4 1134 23232 343434 QWQW2 4 3212 23232 343434 QWQW3 4 and a mapping... (4 Replies)
Discussion started by: kokoro
4 Replies

7. UNIX for Dummies Questions & Answers

awk - Rename output file, after processing, same as input file

I have one input file ABC.txt and one output DEF.txt. After the ABC is processed and created output, I want to rename ABC.txt to ABC.orig and DEF to ABC.txt. Currently when I am doing this, it does not process the input file as it cannot read and write to the same file. How can I achieve this? ... (12 Replies)
Discussion started by: High-T
12 Replies

8. Shell Programming and Scripting

Rename specific file extension in directory with match to another file in bash

I have a specific set (all ending with .bam) of downloaded files in a directory /home/cmccabe/Desktop/NGS/API/2-15-2016. What I am trying to do is use a match to $2 in name to rename the downloaded files. To make things a more involved the date of the folder is unique and in the header of name... (1 Reply)
Discussion started by: cmccabe
1 Replies

9. Shell Programming and Scripting

Bash to copy file 3 times and rename based on another file

In the below bash I am trying to copy the only text file (always only one) in /home/cmccabe/Desktop/list/QC/metrics.txt and rename each of the 3 text files according to /home/cmccabe/Desktop/test/list.txt using lines 3, 4 ,5. This format (that is list.txt) is always 5 lines. Thank you :). ... (12 Replies)
Discussion started by: cmccabe
12 Replies

10. UNIX for Beginners Questions & Answers

Rename file in directory using contents within each file

In the below there are two generic .vcf files (genome.S1.vcf and genome.S2.vcf) in a directory. There wont always be two genaric files but I am trying to use bash to rename each of these generic files with specfic text (unique identifier) within in each .vcf. The text will always be different, but... (11 Replies)
Discussion started by: cmccabe
11 Replies
dc(1)							      General Commands Manual							     dc(1)

Name
       dc - desktop calculator

Syntax
       dc [file]

Description
       The  command  is an arbitrary precision arithmetic package.  Ordinarily it operates on decimal integers, but you can specify an input base,
       output base, and a number of fractional digits to be maintained.  The overall structure of is a stacking (reverse Polish)  calculator.	If
       an  argument  is  given, input is taken from that file until its end, then from the standard input.  The following constructions are recog-
       nized:

       number  The value of the number is pushed on the stack.	A number is an unbroken string of the digits 0-9.  It may be preceded by an under-
	       score _ to input a negative number.  Numbers may contain decimal points.

       +  - /  *  %  ^
	       The  top two values on the stack are added (+), subtracted (-), multiplied (*), divided (/), remaindered (%), or exponentiated (^).
	       The two entries are popped off the stack; the result is pushed on the stack in their place.  Any fractional part of an exponent	is
	       ignored.

       sx      The  top  of  the  stack is popped and stored into a register named x, where x may be any character.  If the s is capitalized, x is
	       treated as a stack and the value is pushed on it.

       lx      The value in register x is pushed on the stack.	The register x is not altered.	All registers start with zero value.  If the l	is
	       capitalized, register x is treated as a stack and its top value is popped onto the main stack.

       d       The top value on the stack is duplicated.

       p       The  top  value	on  the stack is printed.  The top value remains unchanged.  P interprets the top of the stack as an ascii string,
	       removes it, and prints it.

       f       All values on the stack are printed.

       q       Exits the program.  If executing a string, the recursion level is popped by two.  If q is capitalized, the top value on	the  stack
	       is popped and the string execution level is popped by that value.

       x       Treats the top element of the stack as a character string and executes it as a string of commands.

       X       Replaces the number on the top of the stack with its scale factor.

       [ ... ] Puts the bracketed ascii string onto the top of the stack.

       <x  >x  =x
	       The top two elements of the stack are popped and compared.  Register x is executed if they obey the stated relation.

       v       Replaces  the top element on the stack by its square root.  Any existing fractional part of the argument is taken into account, but
	       otherwise the scale factor is ignored.

       !       Interprets the rest of the line as a UNIX command.

       c       All values on the stack are popped.

       i       The top value on the stack is popped and used as the number radix for further input.  When the base (number radix) is  re-set,  all
	       subsequent numbers are interpreted in the new base.

	       For  example, if the command is issued twice, first to set the base to base 2, then to reset it back to base 10, the new base value
	       must be given in the base originally set (that is, `2 i' will set the base to base 2, after which `1010 i' will set it back to base
	       10).

       I       Pushes the input base on the top of the stack.

       o       The top value on the stack is popped and used as the number radix for further output.

       O       Pushes the output base on the top of the stack.

       k       The top of the stack is popped, and that value is used as a non-negative scale factor: the appropriate number of places are printed
	       on output, and maintained during multiplication, division, and exponentiation.  The interaction of scale factor,  input	base,  and
	       output base will be reasonable if all are changed together.

       z       The stack level is pushed onto the stack.

       Z       Replaces the number on the top of the stack with its length.

       ?       A line of input is taken from the input source (usually the terminal) and executed.

       ; :     Used by for array operations.

       An example which prints the first ten values of n! is the following:
       [la1+dsa*pla10>y]sy
       0sa1
       lyx

Diagnostics
       "x is unimplemented"
       x is an octal number.

       "stack empty"
       Not enough elements on the stack to do what was asked.

       "Out of space"
       The free list is exhausted (too many digits).

       "Out of headers"
       Too many numbers being kept around.

       "Out of pushdown"
       Too many items on the stack.

       "Nesting Depth"
       Too many levels of nested execution.

See Also
       bc(1)

																	     dc(1)
All times are GMT -4. The time now is 04:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy