Sponsored Content
Top Forums Shell Programming and Scripting Rename inside the crontab file Post 303013917 by MadeInGermany on Friday 2nd of March 2018 02:39:39 AM
Old 03-02-2018
A leading * requires a leading literal *
Code:
crontab -l | sed 's/_20480/40960/' | crontab -

The idea with a leading character and a trailing character is good, it prevents a partial match in the wrong line. The matching boarder charaters must be re-added in the substitution string
Code:
crontab -l | sed 's#/_20480\.#/40960.#' | crontab -

A compromise is a word match; the anchors \< and \> match a word boundary but not a character, are not to be re-added in the substitution string
Code:
crontab -l | sed 's/\<_20480\>/40960/' | crontab -

 

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

Rename contents inside multiple files

Hi, I have 100 files in a directory. Each file have the following format >CtbRe01234 fdfjdhfkdfkd >CtL2B0456 gjfgfkgjfkgjfk >CmdrE05768 fghdjskksllfkLike this I have many files in the directory. What I want is; rename the header content in each file such that the above file... (6 Replies)
Discussion started by: Lucky Ali
6 Replies

5. Shell Programming and Scripting

Rename files that are inside zip file

Hello to all, I have a zip file with any name like FileName.zip, within the zip file there are more than 30 files with different extensions in the following format. FileName_BMN_ROSJ.txt FileName_THEUS.jpg . . . FileName_KWPWP.shx I would like to unzip the file and rename each file... (2 Replies)
Discussion started by: Ophiuchus
2 Replies

6. 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

7. Shell Programming and Scripting

RMAN commands inside crontab shell script

Hello I'm trying to write simple script to delete archive logs for RMAN, unfortunately it's not working, I tried two way to do that: #!/bin/ksh echo "Start ....." rman target=/ << EOF RUN { delete force noprompt archivelog until time 'sysdate-10'; } EXIT; EOF echo "END ..." echo... (6 Replies)
Discussion started by: samer.odeh
6 Replies

8. 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

9. 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

10. 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
CRONTAB(1)						      General Commands Manual							CRONTAB(1)

NAME
crontab - maintain crontab files for individual users (ISC Cron V4.1) SYNOPSIS
crontab [-u user] file crontab [-u user] [-l | -r | -e] DESCRIPTION
Crontab is the program used to install, deinstall or list the tables used to drive the cron(8) daemon in ISC Cron. Each user can have their own crontab, and though these are files in /var, they are not intended to be edited directly. If the cron.allow file exists, then you must be listed therein in order to be allowed to use this command. If the cron.allow file does not exist but the cron.deny file does exist, then you must not be listed in the cron.deny file in order to use this command. If neither of these files exists, only the super user will be allowed to use this command. If the -u option is given, it specifies the name of the user whose crontab is to be tweaked. If this option is not given, crontab examines "your" crontab, i.e., the crontab of the person executing the command. Note that su(8) can confuse crontab and that if you are running inside of su(8) you should always use the -u option for safety's sake. The first form of this command is used to install a new crontab from some named file or standard input if the pseudo-filename ``-'' is given. The -l option causes the current crontab to be displayed on standard output. The -r option causes the current crontab to be removed. The -e option is used to edit the current crontab using the editor specified by the VISUAL or EDITOR environment variables. After you exit from the editor, the modified crontab will be installed automatically. SEE ALSO
crontab(5), cron(8) FILES
/etc/cron.allow /etc/cron.deny STANDARDS
The crontab command conforms to IEEE Std1003.2-1992 (``POSIX''). This new command syntax differs from previous versions of Vixie Cron, as well as from the classic SVR3 syntax. DIAGNOSTICS
A fairly informative usage message appears if you run it with a bad command line. AUTHOR
Paul Vixie <vixie@isc.org> 4th Berkeley Distribution 29 December 1993 CRONTAB(1)
All times are GMT -4. The time now is 10:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy