Sponsored Content
Top Forums Shell Programming and Scripting Renaming by manipulating strings Post 302718877 by mc2z674gj on Sunday 21st of October 2012 10:48:16 AM
Old 10-21-2012
Code:
ls *ext | perl -F"--" -alne '{if($#F==1){ 
if($F[1]=~/(\d+).ext/){ $p=$1;$F[0]=~s/^/$p /g;$F[1]=~s/$p//;print "mv \"$_\" \"".join(" -- ",@F)."\"" ;} 
else { ($F[0],$F[1])=($F[1],$F[0]);$F[0]=~s/(.ext|^ *)//;$F[1]=~s/ *$/.ext/;print "mv \"$_\" \"".join(" -- ",@F)."\"" ;} 
}else{ ($F[0],$F[2])=($F[2],$F[0]);$F[0]=~s/(.ext|^ *)//;$F[2]=~s/ *$/.ext/;;print "mv \"$_\" \"".join(" -- ",@F)."\"" ;} 
}' | sh

for moving numeric to the beginning, this script works perfectly !

???
i have a question can the script is capable to rename directories
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Manipulating two files

Hi Friends, I prefer to represent my problem with example. I have two files as below: file1.txt --------- abcd.....1234......XY abcd.....1235......XX abcd................. abcd...231236..1111YX abcd...241236..1112YY abcd...241237......YY abce.....1235......YY file2.txt ------- ... (4 Replies)
Discussion started by: rinku11
4 Replies

2. Solaris

Manipulating File

Help...please. I have a log that contains Warning Authentication Failed: User GHDT88998HS doesn't exit: The User GHDT88998HS could not be found Mar 22, 2008 5:22:22AM com.hometel.ttm.auth.userlogin. about maybe a thousand entries failed user acct message How can I grab just the username... (2 Replies)
Discussion started by: rivendell500
2 Replies

3. UNIX for Dummies Questions & Answers

Help!! manipulating file

Hi all, I need help manipulating the file below. Here is what I needed to do. First, I have to replace INSUPD to DELETE. Then I need to change the content of the file around by flipping the contents in the file from the bottom to the top (start from "CMD") How should I attack this? Here... (2 Replies)
Discussion started by: sirrtuan
2 Replies

4. Windows & DOS: Issues & Discussions

Renaming files with strings from xml tags

Hello! I need to rename 400+ xml files. The name of the specific file is contained in a xml tag in the file itself. The batch file should rename all these files with strings found in xml tags. Every xml file has the following tags: <footnote><para>FILENAME</para></footnote> I have to get... (3 Replies)
Discussion started by: degoor
3 Replies

5. Shell Programming and Scripting

Manipulating a file

Hi everybody, I need an urgent help with a BASH script. I have file which contains (besides the other data) the lines with the following structure identified by with keyword PCList: <PARAMETER NAME="PCList" TYPE="LIST_STRUCTURE" MODEL="{,}" ... (1 Reply)
Discussion started by: sameucho
1 Replies

6. UNIX for Dummies Questions & Answers

Delete strings in file1 based on the list of strings in file2

Hello guys, should be a very easy questn for you: I need to delete strings in file1 based on the list of strings in file2. like file2: word1_word2_ word3_word5_ word3_word4_ word6_word7_ file1: word1_word2_otherwords..,word3_word5_others... (7 Replies)
Discussion started by: roussine
7 Replies

7. Shell Programming and Scripting

Delete lines in file containing duplicate strings, keeping longer strings

The question is not as simple as the title... I have a file, it looks like this <string name="string1">RZ-LED</string> <string name="string2">2.0</string> <string name="string2">Version 2.0</string> <string name="string3">BP</string> I would like to check for duplicate entries of... (11 Replies)
Discussion started by: raidzero
11 Replies

8. Programming

Code imrovements on manipulating strings

I have written the code below and would be very grateful for any comments about it (how can I improve it, simplify it,...). #ifndef String_hh #define String_hh #include <stdio.h> #include <string.h> #include <stdlib.h> #include "Vect2.hh" #include "Vector.hh" #include... (0 Replies)
Discussion started by: kristinu
0 Replies

9. Shell Programming and Scripting

Manipulating files

Not sure if the question posted in another forums can be moved by me.So posting the link here. https://www.unix.com/unix-advanced-expert-users/221425-shell-script-manipulate-files.html#post302795379 Need your help here. (1 Reply)
Discussion started by: vedanta
1 Replies

10. UNIX for Beginners Questions & Answers

How to pass strings from a list of strings from another file and create multiple files?

Hello Everyone , Iam a newbie to shell programming and iam reaching out if anyone can help in this :- I have two files 1) Insert.txt 2) partition_list.txt insert.txt looks like this :- insert into emp1 partition (partition_name) (a1, b2, c4, s6, d8) select a1, b2, c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies
EXTCHECK(1)                                                   General Commands Manual                                                  EXTCHECK(1)

NAME
extcheck - check hierarchical ext(5) files for global node connectivity and summarize number of fets, nodes, etc. SYNOPSIS
extcheck [ -c cthresh ] [ -p path ] [ -r rthresh ] [ -s sym=value ] [ -C ] [ -R ] [ -S symfile ] [ -T tech ] root DESCRIPTION
Extcheck will read an extracted circuit in the hierarchical ext(5) representation produced by Magic, check to ensure that all global nodes (those to which a label ending in an exclamantion point is attached) are fully connected in the layout, and then print a count of the num- ber of various items (nodes, fets, etc) encountered while flattening the circuit. The root of the tree to be processed is the file root.ext; it and all the files it references are recursively flattened. The following options are recognized: -c cthresh Set the capacitance threshold to cthresh femtofarads. Extcheck will count the number of explicit internodal capacitors greater than cthresh, the number of nodes whose capacitance is greater than cthresh, as well as the total number of nodes. (Other programs such as ext2sim(1) use this option as a threshold value below which a capacitor will not be output). The default value for cthresh is 10 femtofarads. -p path Normally, the path to search for .ext files is determined by looking for path commands in first ~cad/lib/magic/sys/.magic, then ~/.magic, then .magic in the current directory. If -p is specified, the colon-separated list of directories specified by path is used instead. Each of these directories is searched in turn for the .ext files in a design. -r rthresh Set the resistance threshold to rthresh ohms. Similar in function to -c, but for resistances. The default value for rthresh is 10 ohms. -s sym=value It's possible to use special attributes attached to transistor gates to control the length and width of transistors explicitly, rather than allowing them to be determined by the extractor. These attributes are of the form ext:w=width^ or ext:l=length^, where width or length can either be numeric, or textual. (The trailing ``^'' indicates that these are transistor gate attributes). If textual, they are treated as symbols which can be assigned a numeric value at the time ext2sim is run. The -s flag is used to assign numeric values to symbols. If a textual symbol appears in one of the above attributes, but isn't given a numeric value via -s (or -S below), then it is ignored; otherwise, the transistor's length or width is set to the numeric value defined for that sym- bol. (This option is not currently used by extcheck, but it is common to ext2sim(1) and other tools that are written using the extflat(3) library) -C Set the capacitance threshold to infinity. Because this avoids any internodal capacitance processing, all tools will run faster when this flag is given. -R Set the resistance threshold to infinity. -S symfile Each line in the file symfile is of the form sym=value, just like the argument to the -s flag above; the lines are interpreted in the same fashion. (This option is not currently used by extcheck, but it is common to ext2sim et. al.) -T tech Set the technology in the output .sim file to tech. This overrides any technology specified in the root .ext file. SEE ALSO
ext2dlys(1), ext2sim(1), ext2spice(1), magic(1), rsim(1), sim2spice(1), ext(5), sim(5) AUTHOR
Walter Scott BUGS
The -s mechanism is incomplete; it should allow quantities other than transistor lengths and widths to be specified. EXTCHECK(1)
All times are GMT -4. The time now is 02:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy