Sponsored Content
Top Forums Shell Programming and Scripting Need help in reading a filename Post 302604918 by cns1710 on Tuesday 6th of March 2012 09:47:42 AM
Old 03-06-2012
on top of elixir
Code:
newname=`echo $oldname|awk -F'_[0-9]' '{print $1}'`.`echo $oldname|cut -f2 -d '.'`

Moderator's Comments:
Mod Comment How to use code tags

Last edited by Franklin52; 03-06-2012 at 10:57 AM.. Reason: Please use code tags for code and data samples, thank you
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading a file using sh with spaces in filename

Hi I am trouble parsing through a file with spaces in the filename. I need to grab "supportIDPS/SCM/windows_install/file groups/dds.fgl" and then do a md5sum on it. I am using sh. Any help is appreciated. Here is an example of the input file: 7eedbc9f7902bf4c1878d9e571addf9a ... (4 Replies)
Discussion started by: jekl5
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. UNIX for Dummies Questions & Answers

get the latest file by reading the date in the filename.

Hi, I grep for a pattern in a list of files. "grep -i -l $pattern *.datx*" it may give me n number of files. say for eg, it gives me 2 files. lock_eicu_20071228_00000000.dat_20071228_05343100 lock_eicu_20080501_00000000.dat_20080501_05343900 out of these 2 files I need to get the... (7 Replies)
Discussion started by: prsshini
7 Replies

4. UNIX for Dummies Questions & Answers

Reading filename from directory

I am using the following code to read filename from the directory: for i in ` ls $inputDir | grep $partialName*.csv` do echo $i done But the echo is giving me the following: ls | grep cm_ctx*.csv instead of the full filename "cm_ctx_2009_07_15_17_18.csv" Any ideas anyone? I... (2 Replies)
Discussion started by: khanvader
2 Replies

5. UNIX for Dummies Questions & Answers

assingn a variable a filename and then reading it in

Im trying to set a filename to a variable and then read the file in using the variable but im getting a syntax error. any ideas? #!/bin/bash function scanFile() { while read $1 do echo $filename done } file1=report.log scanFile() $file1 (3 Replies)
Discussion started by: magnia
3 Replies

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

7. Homework & Coursework Questions

Matlab help! Reading in a file with a variable filename

1. The problem statement, all variables and given/known data: I want to read in a file, and plot the data in matlab. However, I do not like hardwiring filenames into my codes, so I always give the user the option to specify what the filename is. I am pretty inexperienced with matlab, so I have no... (0 Replies)
Discussion started by: ds7202
0 Replies

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

9. Shell Programming and Scripting

reading filename in nested directories

Hi all, I have some directory structure as $ls -ltr drwxr-xr-x 1 mscprod us_msc 512 May 10 08:34 650 drwxr-xr-x 1 mscprod us_msc 512 May 10 08:51 652 drwxr-xr-x 1 mscprod us_msc 512 May 10 08:51 640 drwxr-xr-x 1 mscprod us_msc512 May 10 09:13 654 $ cd 650/ $ls fileabc.root and within... (7 Replies)
Discussion started by: emily
7 Replies

10. Open Source

Splitting files using awk and reading filename value from input data

I have a process that requires me to read data from huge log files and find the most recent entry on a per-user basis. The number of users may fluctuate wildly month to month, so I can't code for it with names or a set number of variables to capture the data, and the files are large so I don't... (7 Replies)
Discussion started by: rbatte1
7 Replies
GENLIB_COPY_UP_SEG.3(October 1, 1997)									     GENLIB_COPY_UP_SEG.3(October 1, 1997)

NAME
GENLIB_COPY_UP_SEG - copy a physical segment from an instance in the current figure SYNOPSYS
#include <genlib.h> void GENLIB_COPY_UP_SEG(oldname, insname, newname) char *oldname, *insname, *newname; ORIGIN
This software belongs to the ALLIANCE CAD SYSTEM developed by the ASIM team at LIP6 laboratory of Universite Pierre et Marie CURIE, in Paris, France. Web : http://asim.lip6.fr/recherche/alliance/ E-mail : alliance-users@asim.lip6.fr PARAMETERS
oldname Name of the segment in the instance insname Name of the instance in the which the segment is to be searched for newname Name to be given to the segment in the current figure DESCRIPTION
COPY_UP_SEG adds a segment in the current layout cell. All the segment's attributes are copied from the first found segment called oldname in the instance insname. The new segment is given the name newname. The main purpose of this function is to rename a segment, so it can be used later, when extracting a layout. ERRORS
"GENLIB_COPY_UP_SEG impossible : missing GENLIB_DEF_PHFIG" No figure has been yet specified by a call to DEF_PHFIG. So it isn't possible to place a segment inside it. you must call DEF_PHFIG before any other layout action. "illegal getphins : instance insname does not exist" The instance called insname does not currently belong to the figure. "GENLIB_COPY_UP_SEG impossible : segment segname does not exist" The segment segname does not exist in the model of the instance insname. EXAMPLE
#include <genlib.h> main() { /* Create a figure to work on */ GENLIB_DEF_PHFIG("cell"); GENLIB_PLACE("z2l_y", "r1", NOSYM, 23L, 54L); /* Put a segment */ GENLIB_COPY_UP_SEG("mux0_s", "r1", "out_s"); /* Save that on disk */ GENLIB_SAVE_PHFIG(); } SEE ALSO
genlib(1), GENLIB_DEF_PHFIG(3), GENLIB_SAVE_PHFIG(3), GENLIB_PHSEG(3), GENLIB_THRU_H(3), GENLIB_THRU_CON_H(3), GENLIB_THRU_V(3), GEN- LIB_THRU_CON_V(3), GENLIB_WIRE1(3), GENLIB_WIRE2(3), GENLIB_WIRE3(3). BUG REPORT
This tool is under development at the ASIM department of the LIP6 laboratory. We need your feedback to improve documentation and tools. PROCEDURAL GENERATION LANGUAGE
ASIM/LIP6 GENLIB_COPY_UP_SEG.3(October 1, 1997)
All times are GMT -4. The time now is 05:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy