below are the mentioned files, i want t0 change the last character of the name 00000.cdr with e.g bep01.smsc.191214210500-00000.cdr to bep01.smsc.191214210500-92311.cdr next file be like bep01.smsc.191214210500-92312.cdr
Code:
[root@bep01 done]# ls -ltr | grep 00000.cdr
-rw-r--r-- 1 ss7 ss7 58286 Dec 19 21:09 bep01.smsc.191214210500-00000.cdr
-rw-r--r-- 1 ss7 ss7 52022 Dec 19 21:14 bep01.smsc.191214211000-00000.cdr
-rw-r--r-- 1 ss7 ss7 58772 Dec 19 21:19 bep01.smsc.191214211500-00000.cdr
-rw-r--r-- 1 ss7 ss7 51905 Dec 19 21:24 bep01.smsc.191214212000-00000.cdr
-rw-r--r-- 1 ss7 ss7 52414 Dec 19 21:29 bep01.smsc.191214212500-00000.cdr
-rw-r--r-- 1 ss7 ss7 49413 Dec 19 21:34 bep01.smsc.191214213000-00000.cdr
-rw-r--r-- 1 ss7 ss7 54275 Dec 19 21:39 bep01.smsc.191214213500-00000.cdr
-rw-r--r-- 1 ss7 ss7 46818 Dec 19 21:44 bep01.smsc.191214214000-00000.cdr
-rw-r--r-- 1 ss7 ss7 53009 Dec 19 21:49 bep01.smsc.191214214500-00000.cdr
-rw-r--r-- 1 ss7 ss7 49944 Dec 19 21:54 bep01.smsc.191214215000-00000.cdr
-rw-r--r-- 1 ss7 ss7 51558 Dec 19 21:59 bep01.smsc.191214215500-00000.cdr
-rw-r--r-- 1 ss7 ss7 50739 Dec 19 22:04 bep01.smsc.191214220000-00000.cdr
-rw-r--r-- 1 ss7 ss7 47979 Dec 19 22:09 bep01.smsc.191214220500-00000.cdr
I have 500 files please help to change the name like above.
Moderator's Comments:
Putting QUOTE tags around your entire post and removing ICODE tags does not help us see the commands you have used, the output those commands produced, nor the input you're trying to process. Please use CODE tags when showing nulti-line code segments, sample input, and sample output. You can use ICODE tags when showing in-line input, output, or code in the middle of a sentence.
Last edited by Don Cragun; 12-24-2014 at 02:15 AM..
Reason: Removed QUOTE tags, added CODE and ICODE tags.
in Bash i'm trying to rename directories full of files. the file name pretty much stays the same except for the numerical prefix which will be the same for all files. so, i want to rename these...
45-body.php
45-header.php
45-footer.php
etc.
to...
46-body.php
46-header.php... (2 Replies)
Hi all -
I'm trying to rename a large number of files all at once and need some help figuring out the command line syntax to do it. I've already done quite a bit of research with the rename and mv commands, but so far haven't found a solution that seems to work for me. So:
The files exist... (10 Replies)
hi all,
given a path, for example :
/<pwd>/artist/album/
what i would like to do is to rename the album directory like that :
/<pwd>/artist/artist | album/
and i would like to do the latter for all the "artist" directories
and for all the "album" directories that belong to an artist
... (4 Replies)
Hello all, thanks for your time (and this forum, what an awesome resource for newbs like myself!)
Anyways, I've been given the task of importing content from a directory of about...7000 HTML files. They are all named appropriately and broken down by name depending on what book they belong too.... (8 Replies)
hi i have a folder full of files. some of the names are quite off because the dimensions were the same and i had to put a 'b' after the initial number so that it didnt overwrite. what i want is a script in unix to overwrite the filwe name leaving some of the title intact, e.g. below are some... (3 Replies)
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)
I have some 50+ files in the following format :
abcd_vish_running_ZEBRA_20140818.dat_08-14-2014_23:08:23
abcd_vish_running_ZEB-RA_20140818.dat_08-14-2014_23:08:35
abcd_vish_running_ZEB_RA_20140818.dat_08-14-2014_23:08:37
abcd_vish_running_RI-NG_20140818.dat_08-14-2014_23:08:42... (5 Replies)
I have a .ksh script that creates an sftp batch file and runs it through sftp. It works except for one thing. If I try to "put" to a different name, it doesn't use the specified remote name...it still "puts" the original local name.
I've tried both of these, and neither work...it will always... (4 Replies)
What is wrong with this script to rename batch of similar files? For example renaming all *.txt files to *.tab .
$ for i in seq {01..10}; do touch ${i}.txt; done
$ ./rename.sh *.txt txt tab
Error:
mv: ‘01.txt’ and ‘01.txt’ are the same file.
Code is:
#!/usr/bin/bash
# renames.sh
#... (6 Replies)
I wish to rename all files ending in .txt by removing .tex.
Currently I have
me@me-Inspiron-518:~$ ls
a.tex.txt bin b.tex.txt c.tex.txt Desktop Documents Downloads d.tex.txt Music Pictures Public Templates VideosDesired outcome
me@me-Inspiron-518:~$ ls
a.txt ... (2 Replies)
Discussion started by: Xubuntu56
2 Replies
LEARN ABOUT PHP
mysqli_sqlstate
MYSQLI_SQLSTATE(3) 1 MYSQLI_SQLSTATE(3)mysqli::$sqlstate - Returns the SQLSTATE error from previous MySQL operation
Object oriented style
SYNOPSIS
string$mysqli->sqlstate ()
DESCRIPTION
Procedural style
string mysqli_sqlstate (mysqli $link)
Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters. '00000' means no
error. The values are specified by ANSI SQL and ODBC. For a list of possible values, see http://dev.mysql.com/doc/mysql/en/error-han-
dling.html.
Note
Note that not all MySQL errors are yet mapped to SQLSTATE's. The value HY000 (general error) is used for unmapped errors.
PARAMETERS
o $
link -Procedural style only: A link identifier returned by mysqli_connect(3) or mysqli_init(3)RETURN VALUES
Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters. '00000' means no
error.
EXAMPLES
Example #1
$mysqli->sqlstate example
Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s
", mysqli_connect_error());
exit();
}
/* Table City already exists, so we should get an error */
if (!$mysqli->query("CREATE TABLE City (ID INT, Name VARCHAR(30))")) {
printf("Error - SQLSTATE %s.
", $mysqli->sqlstate);
}
$mysqli->close();
?>
Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s
", mysqli_connect_error());
exit();
}
/* Table City already exists, so we should get an error */
if (!mysqli_query($link, "CREATE TABLE City (ID INT, Name VARCHAR(30))")) {
printf("Error - SQLSTATE %s.
", mysqli_sqlstate($link));
}
mysqli_close($link);
?>
The above examples will output:
Error - SQLSTATE 42S01.
SEE ALSO mysqli_errno(3), mysqli_error(3).
PHP Documentation Group MYSQLI_SQLSTATE(3)