This is great if I know what the suffix is. I was looking for more generality by being able to replace the wild card with some text and leave the rest of the file name as is. So let's call the new function cpr (copy with replace). With the same file set:
I should be able to:
or in a more generalized:
so that every matching string in parameter1 is duplicated in parameter2 on the output, but string3 is inserted in the name. So the command might be:
and the result would be:
After many tries at parameter expansion I can see why the cp command doesn't allow this.
Last edited by Franklin52; 06-21-2013 at 09:32 AM..
Reason: Please use code tags for data and code samples
When I do the following :
grep -l "string" *,
I get a list of file names returned. Is there a way to copy the files returned from the list into another directory ?.
Thanks. (4 Replies)
:confused:Dears ,
I have text file I need to insert the subscriber number at position 32, and need to keep the next field at position 53 (no increasing of the record lenght), I mean I just want to replace the spaces at position 32 with subscirber number .
for example
A B
A ... (1 Reply)
I am in a dire need of doing this job , please help from shell script or perl script. It will be highly appreciated.
Please have a look at the following INPUT file;
The first 14 rows are not of interest but I want them to be included in the output file as they are. From the row 14... (3 Replies)
Hello
Can somebody please help me with the following script?
I'm trying to create a text file with 20 blank lines and then insert a string in line 2 but nothing is printed in the itxtfile. I can create the file with 20 blank lines but when I "tell" it to print something on the second line, it... (4 Replies)
I have a tab delimited text file with multiple columns (data.txt). I would like to insert a column into the text file. The column I want to insert is in a text file (column.txt). I want to insert it into the 5th column of data.txt. How do I go about doing that? Thanks! (2 Replies)
hi,
I am copying a file from 1 folder to another in /bin/sh. if the file already exists there, it should get copied as filename1. again if copying next time it shouldget copied as filename2.. , filename3..so on..
The problem is i am able to get uptil filename1.. but how do i know what... (6 Replies)
Hi to all here ,
Excuse me for the lamer question but I need UNIX command for copying List of Files Under Different File Names !
for example I have this list:
new_001.jpg
new_002.jpg
new_003.jpg
.....
I want to copy all files that start with "new_" to the same directory but under... (7 Replies)
Hi all,
I want to create a file and then insert some text into it. I'm trying to create a .sh script that will create a new python file from a template.
Can someone tell me why this won't work,
touch $1 | sed -e '1i\Some test code here'
Sorry I'm quite new to all this!
Just as a side... (3 Replies)
I need to insert text from one file into another file after specific term. I guess sed is the best method of doing this and I can insert a specified text string using this script but I am not sure how to modify it to insert text from another file:
#!/bin/sh
sed 's/\<VirtualHost... (17 Replies)
Hello,
I've been trying to get a script working that fetches weather-data and converts it into an .ics file. The script works so far put I'm stuck at the point where I need to add specific static data. A thorough search through the forum did not point me into the right direction.
#!/bin/bash... (3 Replies)
Discussion started by: Schubi
3 Replies
LEARN ABOUT PLAN9
inetconv
inetconv(1M) System Administration Commands inetconv(1M)NAME
inetconv - convert inetd.conf entries into smf service manifests, import them into smf repository
SYNOPSIS
inetconv -?
inetconv [-f] [-n] [-i srcfile] [-o destdir]
inetconv -e [-n] [-i srcfile]
DESCRIPTION
The inetconv utility converts a file containing records of inetd.conf(4) into smf(5) service manifests, and then import those manifests
into the smf repository. Once the inetd.conf file has been converted, the only way to change aspects of an inet service is to use the
inetadm(1M) utility.
There is a one-to-one correspondence between a service line in the input file and the manifest generated. By default, the manifests are
named using the following template:
<svcname>-<proto>.xml
The <svcname> token is replaced by the service's name and the <proto> token by the service's protocol. Any slash (/) characters that exist
in the source line for the service name or protocol are replaced with underscores (_).
The service line is recorded as a property of the converted service.
During the conversion process, if a service line is found to be malformed or to be for an internal inetd service, no manifest is generated
and that service line is skipped.
The input file is left untouched by the conversion process.
OPTIONS
The following options are supported:
-?
Display a usage message.
-e
Enable smf services which are listed in the input file.
-f
If a service manifest of the same name as the one to be generated is found in the destination directory, inetconv will overwrite that
manifest if this option is specified. Otherwise, an error message is generated and the conversion of that service is not performed.
-i srcfile
Permits the specification of an alternate input file srcfile. If this option is not specified, then the inetd.conf(4) file is used as
input.
-n
Turns off the auto-import of the manifests generated during the conversion process. Later, if you want to import a generated manifest
into the smf(5) repository, you can do so through the use of the svccfg(1M) utility.
If the -e option is specified, the -n option only displays the smf services that would be enabled.
-o
Permits the specification of an alternate destination directory destdir for the generated manifests. If this option is not specified,
then the manifests are placed in /var/svc/manifest/network/rpc, if the service is a RPC service, or /var/svc/manifest/network other-
wise.
EXAMPLES
Example 1: Generating smf Manifests from inetd.conf
The following command generates smf(5) manifests from inetd.conf(4) and places them in /var/tmp, overwriting any preexisting manifests of
the same name, and then imports them into the smf repository.
# inetconv -f -o /var/tmp
100232/10 -> /var/tmp/100232_10-rpc_udp.xml
Importing 100232_10-rpc_udp.xml ...Done
telnet -> /var/tmp/telnet-tcp6.xml
Importing telnet-tcp6.xml ...Done
Example 2: Generating Manifests from an Alternate Input File
The following command specifies a different input file and does not load the resulting manifests into the smf repository.
# inetconv -n -i /export/test/inet.svcs -o /var/tmp
100232/10 -> /var/tmp/100232_10-rpc_udp.xml
telnet -> /var/tmp/telnet-tcp6.xml
EXIT STATUS
The following exit values are returned:
0
Operation completed successfully (no errors).
1
Invalid options specified.
2
One or more service lines are malformed, and thus no manifest(s) were generated for them.
3
An error occurred importing one or more of the generated manifests.
4
A system error occurred.
FILES
/var/svc/manifest/network/{rpc}/<svcname>-<proto>.xml
default output manifest file name
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|Interface Stability |Evolving |
+-----------------------------+-----------------------------+
SEE ALSO inetadm(1M), inetd(1M), svccfg(1M), inetd.conf(4), attributes(5), smf(5)SunOS 5.10 21 Oct 2004 inetconv(1M)