If you post a question, it's best to also mention the OS, shell, and tools' versions that you use, so a solution can be taylored to your situation. For instance, several seds out there have features that allow for a concise solution that others don't.
- Do you have awk at hand? Could be used to do all of it in one go.
- Did you consider the split command? Looks like it is made for your problem, even to produce the desired file names.
Hi RudiC,
The standard split utility creates output filenames with sequence "numbers" added to the end of a given output filename prefix where the "numbers" aren't numeric; they are names like fasta.aa, fasta.ab, fasta.ac, ...
Like you said, awk would work well for this.
Hi laura,
To get the requested output, one could use something like:
but that would produce names with varying output lengths that would be inconvenient to process if you wanted to handle them in the same order that they originally appeared in the file named out1. If you do later want to process them in that order, you would probably be happier with something more like:
which would produce all 34900 output files with names that start with 5 decimal digits (with leading zeros on the first 9999 files so normal listings of the produced files are in the order you probably want.
If you intend to try this on a Solaris/SunOS operating system, change awk in both of the above suggestions to /usr/xpg4/bin/awk or nawk.
As RudiC said, next time you need help, plan to tell us what operating system as well as what shell you're using and show us what you have tried to solve the problem on your own. We want to help you learn how to do stuff like this on your own; not to act as your unpaid programming staff.
I had a comment on the non-fitting file names similar to what you said but removed it when I tested the split installed on my linux (split (GNU coreutils) 8.28):
Had the requestor told us what system s/he has, a more specific answer had resulted.
How would I write a value to a physical memory address?
I was able to read a physical memory address (for example, 0x400) using this line:
dd if=/dev/mem count=4 bs=1 skip=$(( 0x400 ))
But I get an error:
dd: 'standard input': cannot skip to specified offset
when I try to write using... (1 Reply)
#!/bin/bash -i
SAVEIFS=$IFS
IFS=$"\n\b"
picc=$*
if ; then
echo $TDATE
if ; then
touch dummy
touch -t "tdate" dummy
touch -r "dummy" "$picc"
else
echo -e "No mod date value to apply. If there is one in your shell,\ninvoke \eStarted asking advice on this (on Linuxquestions.org).... (9 Replies)
Hello everyone.
I'm a Linux novice trying out a lot of bash scripting lately, as it is so very addictive.
Lately I have been setting up one of my boxes remotely and have been hardening it as much as possible. Please allow me to explain the scenario, as it does tend to become a little... (1 Reply)
Hi Team
I am trying to put together a nice small script to mount my lvm snapshot
Here are my objectives
1 Check whether snapshot is currently mounted. If so echo umount snapshot and exit from the script.
2 If it's not mounting, check whether the mount point exist, If so, create lvm... (0 Replies)
Hi All,
I am unable to write the script for the below requirement.
Requirement:
Main table dir_ancillary table contain three column "dir_ancillary.table_name"," dir_ancillary.text_file_name ", "dir_ancillary.Include" .
This dir_ancillary contain undefined tables in the column... (2 Replies)
Hi all,
This is my sample code in /etc/httpd/conf.d/applications.conf file currently we are creating subdomain mannually for every new subdomain. I want to automate this process througs bash script , how its possible.
<VirtualHost *:80>
ServerName google.com
ServerAlias google.com... (5 Replies)
I am newbie to UNIX. I came across this exercise in one the books.Can anyone help me with this question??????
Write a short Bash script that, given the name of a file as an argument,
reads the file name and creates a new file containing only lines which consist
of one word. Here is an example... (4 Replies)
I am very new to Linux/Unix. Kindly assist the following:
I wish to write a bash shell script called how_many_to_go that calculates and prints the number of days, hours, minutes and/or seconds until the end of the current month (based on the output of the date command).
Do ... (2 Replies)
Hi,
root@server] df -h
121G 14G 101G 12% /home
147G 126G 14G 91% /backup
We having our site files and images are storing in
/backup/home/user/files/ through symbolic link created in /home directory pointing in /backup directory as following.
root@server] cd /home... (1 Reply)
hi, first congratulations on the nice forum!
Can anybody write script, which can make copy of some or all files of the current directory in new directory (called "backups", which must be made in the current directory, if it's not already exist). And bring out a massage (report) with the count... (7 Replies)