Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Use portion of file name as new file name Post 302988128 by RudiC on Tuesday 20th of December 2016 05:03:57 PM
Old 12-20-2016
Try also
Code:
awk ' -F,
BEGIN   {for (n = split ("JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC", M); n>0; n--) months[M[n]] = sprintf ("AP%02d", n)
        }

        {TMP = FILENAME
         sub ("\..*$", "", TMP)
         print "a_" TMP "_ACTUAL_"months[substr($3,1,3)]"20" substr($3,5,2)"_RR.txt"
        }
' *.txt

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

remove portion of file

Can anyone tell me how to remove a portion of a large file to smaller ones? What I have is a large file that was created becasue several similar files were joined together. Each individual file starts with MSG_HEAD. I want to take everything from MSG_HEAD up to were it says MSG_HEAD again and... (13 Replies)
Discussion started by: methos
13 Replies

2. Shell Programming and Scripting

Separate a portion of text file into another file

Hi, I have my input as follows : I have given two entries- From system Mon Aug 1 23:52:47 2005 Source !100000006!: Impact !100000005!: High Status ! 7!: New Last Name+!100000001!: First Name+ !100000003!: ... (4 Replies)
Discussion started by: srikanth_ksv
4 Replies

3. Programming

Delete Portion of a file

hi i would like to know whether i can delete a part of a file in C for eg. if my file contained 1234567890 and i want to delete 456 so that it becomes 1237890 is there a way i can do this. well, one way i can achieve this is by creating a new file, copy whatever i want, then delete the... (2 Replies)
Discussion started by: sameersbn
2 Replies

4. UNIX for Dummies Questions & Answers

Print a portion of file

Hi, I have a little problem. I am having a file with pattern like : asdf;ffgg;dfjfj;djdfjf;nnjj;djd;ssj; I just want to print the portion from last ";" upto the immediate previous ";". There are several ";" in my line. Please help me out... Thnx in advance (8 Replies)
Discussion started by: vanand420
8 Replies

5. Shell Programming and Scripting

Grep certain portion from the file

Dear Friends, Here I am with another difficulty. I have a flat file from which I wanna grep following pattern. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Statement Date : Blah blah Blah blah Blah blah Blah blah... (1 Reply)
Discussion started by: anushree.a
1 Replies

6. UNIX for Dummies Questions & Answers

Portion of a file in a new files

Hi, I need to devide one file into 3 files based on column numbers and put a string (FILE1, FILE2, FILE3) in the last..... Input file: Column1,Column2,Column3,Column4,Column5,Column6,Column7,Column8,Column9,Column10 Output1: Column1,Column3,Column6,Column4,Column5,FILE1 Output2:... (6 Replies)
Discussion started by: yale_work
6 Replies

7. Shell Programming and Scripting

Rename portion of file based on another file

Hello, I've been searching and reading, but I can't figure out how to solve this problem with my newbie skills. In my directory, I have a list of files (see dirlist.txt attachment) that I need to merge and rename. I have part of the code of the code figured out (see below). However, I... (3 Replies)
Discussion started by: anjulka
3 Replies

8. UNIX for Advanced & Expert Users

Removing portion of file name

Hi , I am getting file name like ABC_DATA_CUSTIOMERS_20120617.dat ABC_DATA_PRODUCTS_20120617.dat Need to convert CUSTIOMERS.dat PRODUCTS.dat Help me how to do this. (7 Replies)
Discussion started by: reach_malu
7 Replies

9. Shell Programming and Scripting

Unix Scripting : Sort a Portion of a File and not the complete file

Need to sort a portion of a file in a Alphabetical Order. Example : The user adam is not sorted and the user should get sorted. I don't want the complete file to get sorted. Currently All_users.txt contains the following lines. ############## # ARS USERS ############## mike, Mike... (6 Replies)
Discussion started by: evrurs
6 Replies

10. UNIX for Dummies Questions & Answers

How to append portion of a file content to another file when a certain pattern is matching?

Hi ladies and gentleman.. I have two text file with me. I need to replace one of the file content to another file if one both files have a matching pattern. Example: text1.txt: ABCD 1234567,HELLO_WORLDA,HELLO_WORLDB DCBA 3456789,HELLO_WORLDE,HELLO_WORLDF text2.txt: XXXX,ABCD... (25 Replies)
Discussion started by: bananamen
25 Replies
SHTOOL-VERSION.TMP(1)					      GNU Portable Shell Tool					     SHTOOL-VERSION.TMP(1)

NAME
shtool-version - GNU shtool maintain version information file SYNOPSIS
shtool version [-l|--language lang] [-n|--name name] [-p|--prefix prefix] [-s|--set version] [-e|--edit] [-i|--increase knob] [-d|--display type] file DESCRIPTION
This command displays and maintains version information in file. The version is always described with a triple <version,revision,level> and is represented by a string which always matches the regular expression ""[0-9]+.[0-9]+[sabp.][0-9]+"". The hexadecimal format for a version "v.rtl" is "VVRRTLL" where "VV" and "RR" directly correspond to "v" and "r", "T" encodes the level type as 9, 2, 1, 0 (representing "s", "p"/".", "b", "a" in this order) and "LL" is either directly corresponding to "l" or set to 99 if level type is "s". OPTIONS
The following command line options are available. -v, --verbose Print verbose information during processing. -l, --language lang Choose format of version file file. lang=""txt"", ANSI C (lang="c"), M4 (lang="m4"), Perl (lang="perl") or Python (lang="python"). Default is "txt". -n, --name name Name the program the version is maintained for. Default is "unknown". -p, --prefix prefix =item -s, --set version Set the version to version. -e, --edit Interactively enter a new version. -i, --increase knob When option ``-i'' is used, the current version in file is updated by increasing one element of the version where knob can be one of the following: ``"v"'' for increasing the version by 1 (and resetting revision and level to 0), ``"r"'' for increasing the revision by 1 (and resetting level to 0) or ``"l"'' for increasing the level by 1. -d, --display type Control the display type: ""short"" for a short version display, ""long"" for a longer version display, ""hex"" for a hexadecimal display of the version and ""libtool"" for a format suitable for use with GNU libtool. EXAMPLE
# shell script shtool version -l c -n FooBar -p foobar -s 1.2b3 version.c # configure.in V=`shtool version -l c -d long version.c` echo "Configuring FooBar, Version $V" HISTORY
The GNU shtool version command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 1994 for OSSP eperl. It was later rewritten from scratch for inclusion into GNU shtool. SEE ALSO
shtool(1). 18-Jul-2008 shtool 2.0.8 SHTOOL-VERSION.TMP(1)
All times are GMT -4. The time now is 06:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy