Sponsored Content
Top Forums Shell Programming and Scripting Help required with a file rename shell script Post 303036418 by MadeInGermany on Tuesday 25th of June 2019 02:10:51 PM
Old 06-25-2019
Here is a standard shell script. It does not remove the .jpg extensions.
It only echoes things, so you get an idea what it could do.
Code:
#!/bin/sh
while IFS="," read f_reg vin s_id rest
do
  # do not process header and junk
  out=""
  if [ "$vin" != "VIN" ] && [ -n "$vin" ] && [ -n "$s_id" ]
  then 
    sep=""
    for i in `ls | grep "^0*${s_id}_"`
    do
      # rename from $s_id to $vin, delete leading 0 characters
      new_i=`echo "$i" | sed "s/^0*${s_id}_0*/${vin}_/"`
      echo mv "$i" "$new_i"
      out="${out}${sep}${new_i}"
      sep=" "
    done
  fi
  # delete a trailing comma before adding a new one as separator
  echo "$f_reg,$vin,$s_id,${rest%,}${out:+,$out}"
done < test.csv

This User Gave Thanks to MadeInGermany For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Urgent help required in deleting a line without opening a file usinga shell script

Hi, I need a help in deleting a line matching a particular pattern in a file using shell script without opening the file. The file is a .c/.cpp file. Is it possible? Thanks (6 Replies)
Discussion started by: naan
6 Replies

2. Shell Programming and Scripting

shell script required

hi , i need a shell script that will remove the first and second lines of the text file and will list the word count of the characters present in it. the text file will be consisting of multiple textfiles.the first text file starts from 01-34.like wise the next file also starts from 01-34... (4 Replies)
Discussion started by: sethunath
4 Replies

3. Linux

shell script required

Hi, iam presenting the input text file format.Of this i need the character count of the number of characters present in each file.The attached file is a combination of 3 text file.each text file starts at record 1 - 34, then the next tetx file starts. What i need is the character count of each... (1 Reply)
Discussion started by: sethunath
1 Replies

4. Shell Programming and Scripting

Shell script help required

Hi, Can someone help me with this small piece of code. DIRNAME=$(dirname $0) BASENAME=$(basename $0) DATA="${DIRNAME}/${BASENAME}.data" && . $DATA whats is meant by && . $DATA here... Regards, Abhishek (2 Replies)
Discussion started by: max29583
2 Replies

5. UNIX for Dummies Questions & Answers

Shell script to rename or change file extension case.

I searched the forum, but there was different type of rename. Hello. I have files in folder. Like: xxxxxxxx1.html or xxxxxxxx2.txt or xxxxxxxx3.tar.gz and how to rename or change file extension case to xxxxxxxx1.htm or xxxxxxx2.TXT or (5 Replies)
Discussion started by: Sheldon
5 Replies

6. UNIX for Advanced & Expert Users

Rename a file to a file_current datetime in a shell script

Hi all, Could anyone suggest me on Renaming a file to a file_current datetime in a shell script. (3 Replies)
Discussion started by: Nithin
3 Replies

7. Shell Programming and Scripting

write shell script to rename file

hi, I need some help in writing shell script in a bourne shell.I am trying to rename the file.. eg. find /root/data -type f -name "text*) | while read FILES do newfile=${FILES/type_2.0_20101208_34.xml / tmp.xml} mv "$FILES" "$newfile" done above written script is working...If the... (7 Replies)
Discussion started by: shubhig15
7 Replies

8. Shell Programming and Scripting

Shell script is required

Dear All I have a filelisting as below: abcd_20110715_0007 abcd_20110715_0010 abcd_20110716_0001 abcd_20110716_0004 abcd_20110715_0008 abcd_20110715_0011 abcd_20110716_0002 abcd_20110716_0005 abcd_20110715_0009 abcd_20110715_0012 abcd_20110716_0003 abcd_20110716_0006 ... (3 Replies)
Discussion started by: at1700
3 Replies

9. Shell Programming and Scripting

help required with shell script

Hi, My input file as follws $ cat 1.txt ------- a aa aaa 11 b bb bbb 22 I am able to extract first and last column of a given line as follows. $ nawk '{print $1}' FS= RS= 1.txt | awk '{ $NF = ""; print }' a $ nawk '{print $1}' FS= RS= 1.txt | awk '{ print $NF}' 11 however, the... (4 Replies)
Discussion started by: bala123
4 Replies

10. UNIX for Dummies Questions & Answers

Shell script required

Hi, I need shell script for getting the date in format from below text output IP IS 10.238.52.65 pun-ras-bng-mhs-01#show conf port 2/4 Building configuration... Current configuration: ! card ge3-4-port 2 ! port ethernet 2/4 no shutdown encapsulation dot1q (7 Replies)
Discussion started by: surender reddy
7 Replies
DateTime::Locale::fur_IT(3)				User Contributed Perl Documentation			       DateTime::Locale::fur_IT(3)

NAME
DateTime::Locale::fur_IT SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'fur_IT' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Friulian Italy. DATA
This locale inherits from the DateTime::Locale::fur locale. It contains the following data. Days Wide (format) lunis martars miercus joibe vinars sabide domenie Abbreviated (format) lun mar mie joi vin sab dom Narrow (format) L M M J V S D Wide (stand-alone) lunis martars miercus joibe vinars sabide domenie Abbreviated (stand-alone) lun mar mie joi vin sab dom Narrow (stand-alone) L M M J V S D Months Wide (format) Zenar Fevrar Marc Avril Mai Jugn Lui Avost Setembar Otubar Novembar Dicembar Abbreviated (format) Zen Fev Mar Avr Mai Jug Lui Avo Set Otu Nov Dic Narrow (format) Z F M A M J L A S O N D Wide (stand-alone) Zenar Fevrar Marc Avril Mai Jugn Lui Avost Setembar Otubar Novembar Dicembar Abbreviated (stand-alone) Zen Fev Mar Avr Mai Jug Lui Avo Set Otu Nov Dic Narrow (stand-alone) Z F M A M J L A S O N D Quarters Wide (format) Prin trimestri Secont trimestri Tierc trimestri Cuart trimestri Abbreviated (format) T1 T2 T3 T4 Narrow (format) 1 2 3 4 Wide (stand-alone) Prin trimestri Secont trimestri Tierc trimestri Cuart trimestri Abbreviated (stand-alone) T1 T2 T3 T4 Narrow (stand-alone) 1 2 3 4 Eras Wide pdC ddC Abbreviated pdC ddC Narrow pdC ddC Date Formats Full 2008-02-05T18:30:30 = martars 5 di Fevrar dal 2008 1995-12-22T09:05:02 = vinars 22 di Dicembar dal 1995 -0010-09-15T04:44:23 = sabide 15 di Setembar dal -10 Long 2008-02-05T18:30:30 = 5 di Fevrar dal 2008 1995-12-22T09:05:02 = 22 di Dicembar dal 1995 -0010-09-15T04:44:23 = 15 di Setembar dal -10 Medium 2008-02-05T18:30:30 = 05/02/2008 1995-12-22T09:05:02 = 22/12/1995 -0010-09-15T04:44:23 = 15/09/-010 Short 2008-02-05T18:30:30 = 05/02/08 1995-12-22T09:05:02 = 22/12/95 -0010-09-15T04:44:23 = 15/09/-10 Default 2008-02-05T18:30:30 = 05/02/2008 1995-12-22T09:05:02 = 22/12/1995 -0010-09-15T04:44:23 = 15/09/-010 Time Formats Full 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Long 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Medium 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Short 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 09:05 -0010-09-15T04:44:23 = 04:44 Default 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Datetime Formats Full 2008-02-05T18:30:30 = martars 5 di Fevrar dal 2008 18:30:30 UTC 1995-12-22T09:05:02 = vinars 22 di Dicembar dal 1995 09:05:02 UTC -0010-09-15T04:44:23 = sabide 15 di Setembar dal -10 04:44:23 UTC Long 2008-02-05T18:30:30 = 5 di Fevrar dal 2008 18:30:30 UTC 1995-12-22T09:05:02 = 22 di Dicembar dal 1995 09:05:02 UTC -0010-09-15T04:44:23 = 15 di Setembar dal -10 04:44:23 UTC Medium 2008-02-05T18:30:30 = 05/02/2008 18:30:30 1995-12-22T09:05:02 = 22/12/1995 09:05:02 -0010-09-15T04:44:23 = 15/09/-010 04:44:23 Short 2008-02-05T18:30:30 = 05/02/08 18:30 1995-12-22T09:05:02 = 22/12/95 09:05 -0010-09-15T04:44:23 = 15/09/-10 04:44 Default 2008-02-05T18:30:30 = 05/02/2008 18:30:30 1995-12-22T09:05:02 = 22/12/1995 09:05:02 -0010-09-15T04:44:23 = 15/09/-010 04:44:23 Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 mar 1995-12-22T09:05:02 = 22 vin -0010-09-15T04:44:23 = 15 sab Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 p. 1995-12-22T09:05:02 = 9:05 a. -0010-09-15T04:44:23 = 4:44 a. Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 p. 1995-12-22T09:05:02 = 9:05:02 a. -0010-09-15T04:44:23 = 4:44:23 a. M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (d/M) 2008-02-05T18:30:30 = 5/2 1995-12-22T09:05:02 = 22/12 -0010-09-15T04:44:23 = 15/9 MEd (E d/M) 2008-02-05T18:30:30 = mar 5/2 1995-12-22T09:05:02 = vin 22/12 -0010-09-15T04:44:23 = sab 15/9 MMd (d/MM) 2008-02-05T18:30:30 = 5/02 1995-12-22T09:05:02 = 22/12 -0010-09-15T04:44:23 = 15/09 MMM (LLL) 2008-02-05T18:30:30 = Fev 1995-12-22T09:05:02 = Dic -0010-09-15T04:44:23 = Set MMMd (d MMM) 2008-02-05T18:30:30 = 5 Fev 1995-12-22T09:05:02 = 22 Dic -0010-09-15T04:44:23 = 15 Set MMMEd (E d MMM) 2008-02-05T18:30:30 = mar 5 Fev 1995-12-22T09:05:02 = vin 22 Dic -0010-09-15T04:44:23 = sab 15 Set MMMMd (d 'di' MMMM) 2008-02-05T18:30:30 = 5 di Fevrar 1995-12-22T09:05:02 = 22 di Dicembar -0010-09-15T04:44:23 = 15 di Setembar MMMMEd (E d MMMM) 2008-02-05T18:30:30 = mar 5 Fevrar 1995-12-22T09:05:02 = vin 22 Dicembar -0010-09-15T04:44:23 = sab 15 Setembar ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (M/yyyy) 2008-02-05T18:30:30 = 2/2008 1995-12-22T09:05:02 = 12/1995 -0010-09-15T04:44:23 = 9/-010 yMEd (EEE, d/M/yyyy) 2008-02-05T18:30:30 = mar, 5/2/2008 1995-12-22T09:05:02 = vin, 22/12/1995 -0010-09-15T04:44:23 = sab, 15/9/-010 yMMM (MMM y) 2008-02-05T18:30:30 = Fev 2008 1995-12-22T09:05:02 = Dic 1995 -0010-09-15T04:44:23 = Set -10 yMMMEd (EEE d MMM y) 2008-02-05T18:30:30 = mar 5 Fev 2008 1995-12-22T09:05:02 = vin 22 Dic 1995 -0010-09-15T04:44:23 = sab 15 Set -10 yMMMM (LLLL 'dal' y) 2008-02-05T18:30:30 = Fevrar dal 2008 1995-12-22T09:05:02 = Dicembar dal 1995 -0010-09-15T04:44:23 = Setembar dal -10 yQ (Q yyyy) 2008-02-05T18:30:30 = 1 2008 1995-12-22T09:05:02 = 4 1995 -0010-09-15T04:44:23 = 3 -010 yQQQ (QQQ y) 2008-02-05T18:30:30 = T1 2008 1995-12-22T09:05:02 = T4 1995 -0010-09-15T04:44:23 = T3 -10 yyMM (MM/yy) 2008-02-05T18:30:30 = 02/08 1995-12-22T09:05:02 = 12/95 -0010-09-15T04:44:23 = 09/-10 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 yyyyMMMM (MMMM y) 2008-02-05T18:30:30 = Fevrar 2008 1995-12-22T09:05:02 = Dicembar 1995 -0010-09-15T04:44:23 = Setembar -10 Miscellaneous Prefers 24 hour time? Yes Local first day of the week lunis SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.16.3 2014-06-10 DateTime::Locale::fur_IT(3)
All times are GMT -4. The time now is 06:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy