Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Script batch with command sed Post 302867841 by krishmaths on Friday 25th of October 2013 06:15:19 AM
Old 10-25-2013
Code:
DIR=/directory/with/2000/files
for FILE in $(ls $DIR)
do
 echo "insert into tabella ('"$(awk '{print substr($0,1,7)}' $DIR/$FILE)"','"$(cat $DIR/$FILE)"');"
done

Beware of ' appearing within fields for inserts to be successful.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using Batch command

Hi All I have a need due time constraint to issue the mail command in background. I have a script that sends a message to a mail address as follows :- echo "$MLINE" | mail -s "$HOST - $TEXT" name@co.com & The script runs frequently and I check to see if the script is active and if it is , it... (5 Replies)
Discussion started by: jhansrod
5 Replies

2. UNIX for Dummies Questions & Answers

batch command in a shell script

How do I execute a batch command from a script, which "waits" with the next command until the first one has finished? ======= A piece of my script looks like this: #!/bin/sh (...) # run a long batch job: ./run_calculation.sh # then rename resulting file: mv output.dat backup.dat (...) ... (7 Replies)
Discussion started by: ivvo
7 Replies

3. Shell Programming and Scripting

su command in batch mode

Hi, how do we change user in a shell script- batch mode. Thanks, Rajesh (3 Replies)
Discussion started by: Rajesh Gohad
3 Replies

4. UNIX for Dummies Questions & Answers

batch file using sed command in msdos

<! pad_meth: <! program = "/usr/lib/drivers/pse/x29d -p" how should i program it in oder to display this: <! pad_meth: <! program = "/usr/lib/drivers/pse/x29d -p" ;) (1 Reply)
Discussion started by: rita1985
1 Replies

5. Shell Programming and Scripting

use sed do batch wildcard string replace

Hi, Here is what I want to do I want to search local directory and its sub directory, all the files which contain any string like _12345, then remove this string. String is a combination of _ plus a random integer number. For example, here is one line in a file before <properties... (1 Reply)
Discussion started by: bp5000
1 Replies

6. Shell Programming and Scripting

try to batch rename using sed (if this is best)

hi gooday I need some help with a rename I am attempting. I'd like to rename a bunch of files in a folder example list.dat.old to list_N.dat query.dat.old to query_N.dat note the two periods in (.dat.old) to become _N.dat I tried using sed like this ls *.dat.old | sed... (3 Replies)
Discussion started by: johnstrong
3 Replies

7. Shell Programming and Scripting

Sed or awk for batch replace file name

Can you please point me in the correct direction? I need a line or script to run though a given directory and find all files with "@domain.local" in there names and simple remove that. For example if the files were named 1234@domain.local the file would then become 1234. (1 Reply)
Discussion started by: binary-ninja
1 Replies

8. Shell Programming and Scripting

Executing a batch of files within a shell script with option to refire the individual files in batch

Hello everyone. I am new to shell scripting and i am required to create a shell script, the purpose of which i will explain below. I am on a solaris server btw. Before delving into the requirements, i will give youse an overview of what is currently in place and its purpose. ... (2 Replies)
Discussion started by: goddevil
2 Replies

9. UNIX for Advanced & Expert Users

Batch SFTP command Help

I need to run a test SFTP command in a batch mode and what I need to prompt my password after the sftp userid@hostname. I do not have have an ssh key exchanged between my server and the external server. I only have access to it as an sftp server. I must enter my password in my script. How do i... (2 Replies)
Discussion started by: mrn6430
2 Replies

10. Shell Programming and Scripting

sed batch file issue

Hi!! I want to create a batch file so the sh file could change a file on a specific time. I made this config: sed -i 's/range 192.168.1.200 192.168.1.220;/option POLYCOM "tftp://10.20.1.10";/g' /etc/dhcp3/dhcpd.conf My issue is that the sed does not accept the :// character.... (2 Replies)
Discussion started by: jocas9
2 Replies
packf(1)						      General Commands Manual							  packf(1)

NAME
packf - compress a folder into a single file (only available within the message handling system, mh) SYNOPSIS
packf [+folder] [msgs] [-file name] [-help] OPTIONS
Specifies the file in which you want the message(s) to be stored. If you specify an existing file then the specified messages will be appended to the end of that file. Otherwise, a new file will be created and the messages placed in it. If you do not specify a filename, packf attempts to place the messages in a file called msgbox in the current working directory. If this file does not exist, packf asks whether you want to create it. Prints a list of the valid options to this command. The default settings for this command are: +folder defaults to the current folder msgs defaults to all -file DESCRIPTION
Each message in a folder is normally stored as a separate file. The packf command takes all messages from the current folder and copies them to a single specified file. Each message in the file is separated by four <CTRL/A>s and a newline. You can specify a folder other than the current folder by using the +folder argument. If you do not want all the messages in a folder to be packed into one file, you can specify a number of messages or a range of messages with message numbers. The first message packed will become the current message. If you specify a +folder argument, that folder will become the current folder. When messages have been packed into a file using packf, you can separate them into individual messages using the burst command. See burst(1). PROFILE COMPONENTS
Path: To determine the user's Mail directory Msg-Protect: To set protections when creating a new file EXAMPLES
The first example shows all the messages in the folder +lrp being packed into a file called planning: % packf +lrp -file planning The next example shows how packf prompts you if you do not specify a -file option. A file called msgbox is created by packf in your home directory, and messages 3 to 5 are packed into it: % packf +lrp 3-5 Create file "/machine/disk/username/msgbox"? y FILES
The user profile. SEE ALSO
burst(1) packf(1)
All times are GMT -4. The time now is 05:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy