Sponsored Content
Top Forums Shell Programming and Scripting Help with modifying a filename Post 302923361 by Aia on Saturday 1st of November 2014 07:47:20 PM
Old 11-01-2014
Code:
ls * | perl -lne 'print "$& $_" if s/(^[A-Z]{3}_\d+_)\d\d(\d\d.*$)/$1$2/'

If you like the result then change the red part to rename the files:
Code:
ls * | perl -lne 'rename $&, $_ if s/(^[A-Z]{3}_\d+_)\d\d(\d\d.*$)/$1$2/'


Last edited by Aia; 11-01-2014 at 08:57 PM.. Reason: Explicit mention to rename
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

shortcut for tar cvf - [filename] | gzip > [filename].tar.gz

i'd like to have an alias (or something similar) where i can type a command like "archive" and a filename and have it tar and gzip the file, so... $ archive filename results in filename.tar.gz...do i have to write a script to do this? (4 Replies)
Discussion started by: bcamp1973
4 Replies

2. Shell Programming and Scripting

gzcat into awk and then change FILENAME and process new FILENAME

I am trying to write a script that prompts users for date and time, then process the gzip file into awk. During the ksh part of the script another file is created and needs to be processed with a different set of pattern matches then I need to combine the two in the end. I'm stuck at the part... (6 Replies)
Discussion started by: timj123
6 Replies

3. Shell Programming and Scripting

rename multiple filename.45267.txt to >> filename.txt

i have several thousand files and in subdirs that are named file.46634.txt budget.75346.pdf etc i want to remove the number but retain the extension. it is always a 5 digit. thanks. (6 Replies)
Discussion started by: jason7
6 Replies

4. Shell Programming and Scripting

Filename from splitting files to have the same filename of the original file with counter value

Hi all, I have a list of xml file. I need to split the files to a different files when see the <ko> tag. The list of filename are B20090908.1100-20090908.1200_CDMA=1,NO=2,SITE=3.xml B20090908.1200-20090908.1300_CDMA=1,NO=2,SITE=3.xml B20090908.1300-20090908.1400_CDMA=1,NO=2,SITE=3.xml ... (3 Replies)
Discussion started by: natalie23
3 Replies

5. Shell Programming and Scripting

modifying a row

I want to modify a file by deleting certain characters. The file looks like this: >ctg86 org=S_bayanus] moltype=genomictg] ctgontig=ctg86] RRRRRRRRRRRRRRRRRRRRRRRRRRRRTTTTTTTTTTTTTTTTTTTTTTTYYYYYYYYYYYYYYYYYYYYFFFFFFFFFFFGGGGGGGGGHHHHH >ctg86 org=S_bayanus] moltype=genomictg] ctgontig=ctg86]... (4 Replies)
Discussion started by: phil_heath
4 Replies

6. Post Here to Contact Site Administrators and Moderators

Modifying old post

If I had posted the organisations server name by overlook and people replied to my post. Later on realising that I had shared some info that should not have been, how can I remove or delete such info from my previous posts? (4 Replies)
Discussion started by: mohtashims
4 Replies

7. UNIX for Dummies Questions & Answers

to extract all the part of the filename before a particular word in the filename

Hi All, Thanks in Advance I am working on a shell script. I need some assistance. My Requirement: 1) There are some set of files in a directory like given below OTP_UFSC_20120530000000_acc.csv OTP_UFSC_20120530000000_faf.csv OTP_UFSC_20120530000000_prom.csv... (0 Replies)
Discussion started by: aealexanderraj
0 Replies

8. Programming

to extract all the part of the filename before a particular word in the filename

Hi All, Thanks in Advance I am working on a shell script. I need some assistance. My code: if then set "subscriber" "promplan" "mapping" "dedicatedaccount" "faflistSub" "faflistAcc" "accumulator"\ "pam_account"; for i in 1 2 3 4 5 6 7 8;... (0 Replies)
Discussion started by: aealexanderraj
0 Replies

9. Shell Programming and Scripting

Modifying the .bashrc

I have modified the .bashrc. The problem is that when I write a long command, it does not write on the next line but continues to write on the same line. # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for... (1 Reply)
Discussion started by: kristinu
1 Replies

10. Shell Programming and Scripting

[Solved] Modifying/Removing Timestamps from a filename

So given filenames of varying lengths, I was wondering how I would remove or modify appended timestamps of the current date DD-MM-YY. So say: test_DD-MM-YY.txt coolbeans_DD-MM-YY.pdf And what I expect the output to be: test.txt coolbeans.pdf Thanks :) (2 Replies)
Discussion started by: sodaboyz
2 Replies
XSetLineAttributes(3X11)												  XSetLineAttributes(3X11)

Name
       XSetLineAttributes, XSetDashes - GC convenience routines

Syntax
       XSetLineAttributes(display, gc, line_width, line_style, cap_style, join_style)
	     Display *display;
	     GC gc;
	     unsigned int line_width;
	     int line_style;
	     int cap_style;
	     int join_style;

       XSetDashes(display, gc, dash_offset, dash_list, n)
	       Display *display;
	       GC gc;
	       int dash_offset;
	       char dash_list[];
	       int n;

Arguments
       cap_style Specifies the line-style and cap-style you want to set for the specified GC.  You can pass or

       dash_list Specifies the dash-list for the dashed line-style you want to set for the specified GC.

       dash_offset
		 Specifies the phase of the pattern for the dashed line-style you want to set for the specified GC.

       display	 Specifies the connection to the X server.

       gc	 Specifies the GC.

       join_style
		 Specifies the line join-style you want to set for the specified GC.  You can pass or

       line_style
		 Specifies the line-style you want to set for the specified GC.  You can pass or

       line_width
		 Specifies the line-width you want to set for the specified GC.

       n	 Specifies the number of elements in dash_list.

Description
       The function sets the line drawing components in the specified GC.

       can generate and errors.

       The  function sets the dash-offset and dash-list attributes for dashed line styles in the specified GC.	There must be at least one element
       in the specified dash_list, or a error results.	The initial and alternating elements (second, fourth, and so on) of the dash_list are  the
       even dashes, and the others are the odd dashes.	Each element specifies a dash length in pixels.  All of the elements must be nonzero, or a
       error results.  Specifying an odd-length list is equivalent to specifying the same list concatenated with itself to produce an  even-length
       list.

       The  dash-offset  defines  the phase of the pattern, specifying how many pixels into the dash-list the pattern should actually begin in any
       single graphics request.  Dashing is continuous through path elements combined with a join-style but is reset to the dash-offset each  time
       a cap-style is applied at a line endpoint.

       The  unit  of measure for dashes is the same for the ordinary coordinate system.  Ideally, a dash length is measured along the slope of the
       line, but implementations are only required to match this ideal for horizontal and vertical lines.  Failing the ideal semantics, it is sug-
       gested  that  the length be measured along the major axis of the line.  The major axis is defined as the x axis for lines drawn at an angle
       of between -45 and +45 degrees or between 315 and 225 degrees from the x axis.  For all other lines, the major axis is the y axis.

       can generate and errors.

Diagnostics
       The server failed to allocate the requested resource or server memory.

       A value for a GContext argument does not name a defined GContext.

       Some numeric value falls outside the range of values accepted by the request.
		 Unless a specific range is specified for an argument, the full range defined by the argument's type is  accepted.   Any  argument
		 defined as a set of alternatives can generate this error.

See Also
       XCreateGC(3X11), XQueryBestSize(3X11), XSetArcMode(3X11), XSetClipOrigin(3X11), XSetFillStyle(3X11), XSetFont(3X11), XSetState(3X11), XSet-
       Tile(3X11)
       Guide to the Xlib Library

															  XSetLineAttributes(3X11)
All times are GMT -4. The time now is 12:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy