Using awk to append incremental numbers to the end of duplicate file names.
I'm currently working on a script that extracts files from a .zip, runs an sha1sum against them and then uses awk to pre-format them into zomething more readable thusly:
The problem I am having is that since this file operates on zips sometimes it will result in files with duplicate names appearing in a specific subset of files. For example subset 69 has File4 appear three times and File2 twice, while subset 47 has File3 appear twice. what I am trying to accomplish is to make awk check for duplicate occurances of $4 within a $2 subset and then use '{ count=1, count++ }' to append incrementally increasing numbers to the end of those files, thus making them uniqe, Any help or hints on how I might accomplish this would be appreciated since I'm pulling my hair out over this.
I need the line printed with echo to append to eof of to exactly line, am i able to do that?
i mean
echo "sysctl -w lalala=1" > to end of file /etc/sysctl.conf
or to the 21st line, if the line exist, open new line and insert text there.
Thx.maybe i'm in wrong topic but anyway... (2 Replies)
I am trying to write a housekeeping bash script. Part of it involves searching all of my attached storage media for photographs and moving them into a single directory. The problem occurs when files have duplicate names, obviously a file called 001.jpg will get overwritten with another file... (6 Replies)
Hi All,
Is there any way to append a newline character at the end of a file(coma-separated file), through shell script?
I need to check whether newline character exists at the end of a file, if it does not then append it.
Regards,
Krishna (1 Reply)
Hi all,
i have to append a record at the end of the file(a file which is already with some records).how do i do?please help me?
is there any way of doing this with "SED" command.i am not sure.plz help me on this.
would appreciate your ideas!!!!
bye
rao. (3 Replies)
Hi Guru's,
Before writing to this forum I have searched extensively on this forum about my problem.
I have to write a shell script which takes out only those file names from the given directory which contains only numbers. For example, In the given directory these files are present:
... (0 Replies)
Hi Guru's,
Before writing to this forum I have searched extensively on this forum about my problem.
I have to write a shell script which takes out only those file names from the given directory which contains only numbers. For example, In the given directory these files are present:
... (4 Replies)
Hi All,
I have a directory in which all log files will be generated. Apart from the log files, there are a few other files also generated. I want the names of all files which does not end with .LOG.
consider the dir has the following files
I want only ebaf02012009.ERR file.
Unix... (4 Replies)
Hi All,
I have some thousand files with names like 1.syl, 2.syl, 5.syl etc.
These files contain one sentence each. I want to store all those sentences along with the file ID that is 1, 2, 5 with the sentences they contain.
For example,
1.syl has
this is a test line
2.syl has
... (3 Replies)
Hi Unix forum.
I have the following requirement to add a sequence value to each record in a file but only if it meets certain conditions. Field value in pos. 1 and 2 must be '0B' or 'OA' else leave as is. Sequence value must be preserved for each OB and OA pair.
Data Before:
123
456... (5 Replies)
Discussion started by: pchang
5 Replies
LEARN ABOUT ULTRIX
stl_key
stl_key(5) File Formats Manual stl_key(5)Name
stl_key - setld kit manufacturing key file
Description
The manufacturing key files are used by the software kitting program in producing software distribution packages in format.
A key file has a global data section and a subset descriptor section. The sections are separated by a line that is empty except for the %%
character sequence.
The global section contains the product level attributes of the product. Comments are permitted in this section. They begin with the number
sign (#) character and end at the next newline character. Attributes are specified by giving the attribute key, an equal sign (=), and a
value for the attribute. There must be no white space surrounding the equals sign (=). There are five attributes that must be present with
non-null values. These are NAME, CODE, VERS, MI, and ROOT. An explanation of each of the attributes follows:
NAME The name of the product. The value for NAME is a string of up to 40 characters.
CODE The 3-character product code for the product, for example, ULT.
VERS The 3-digit version code for the product, for example, 040.
MI The pathname of the master inventory file for the product.
ROOT A flag with values of 0 or 1. It is used to determine if a ROOT image checksum should be computed for the product image file.
There is no ROOT image in any product other than ULTRIX. Set it to 0.
RXMAKE A flag with values of 0 or 1. Setting it to 0 suppresses the manufacture of subset images for distribution on RX50 diskettes.
Omitting this attribute from the key file will cause the program to assume a default value of 1. Digital recommends setting it
to 0.
COMPRESS A flag with values of 0 or 1. Setting it to 1 causes the subset images to be compressed using the utility, thereby saving
space on the distribution media. Setting it to 0 suppresses compression. Omitting this attribute from the key file will cause
the program to assign a default value of 0.
The subset descriptor section contains one subset descriptor for each subset in the product. There is one subset descriptor per line in
this section and comments are not permitted.
A subset descriptor contains subset-specific attributes in four fields separated by TAB (CTRL/I) characters. A description of each field
follows:
SUBSET This field contains the name of the subset being described by the descriptor. The subset name is composed of the product code,
name and version code.
DEPENDENCIES
A list of subsets on which the described subset depends. If there are no such subsets, the period character (.) is used. Mul-
tiple subset dependencies are separated by a vertical bar character (|).
FLAGS A subset flags value. This is an integer. Bit 0 is used to mark the subset as irremovable. If bit 0 is set, can never delete
the subset. Bit 1 is used to mark the subset as optional, otherwise it is mandatory and must be installed from the media when
encountered by
DESCRIPTION
This is a description of the subset in 40 or fewer characters. It is used in the menu that presents to a user installing the
software. If spaces are desired in this field, the field must be enclosed in single quotes.
The subset descriptors must be listed in the order in which the subsets are installed by
Restrictions
The required attributes and default values are not optimal.
Comments in the subset descriptor section will cause serious problems when encountered by the program.
TAB formatting in the subset descriptors is tightly enforced by the program.
Examples
This is an example key file:
# ULW400.k -
# ULTRIX WS V4.0 Server 2/2 (VAX) Mfg Key File
#
# "@(#)ULW400.k 2.2 (ULTRIX) 4/12/89"
#
# 000 02-mar-1989 ccb
# Copy from V2.0 (VAX) Sources
# Revision update for V4.0
#% PRODUCT-LEVEL ATTRIBUTES
NAME='ULTRIX Worksystem Software V4.0'
CODE=UWS
VERS=400
MI=ULT400.mi
ROOT=0
RXMAKE=0
COMPRESS=1
#% SUBSET-LEVEL ATTRIBUTES
%%
UWSX11400 ULTINET400 0 'X11/DECwindows User Environment'
UWSFONT400 UWSX11400 0 'X11/DECwindows 75dpi Fonts'
UWSFONT15400 . 2 'X11/DECwindows 100dpi Fonts'
UWSDECW400 . 2 'Optional DECwindows Applications'
UWSXDEV400 ULTPGMR400 2 'Worksystems Development Software'
UWSMAN400 ULTDCMT400 2 'UWS Manual Pages'
See Alsokits(1), stl_comp(5), stl_ctrl(5), stl_image(5), setld(8)
Guide to Preparing Software for Distribution on ULTRIX Systems
stl_key(5)