Sponsored Content
Top Forums Shell Programming and Scripting Processing files using ksh shell Post 302404691 by dennis.jacob on Wednesday 17th of March 2010 04:24:20 AM
Old 03-17-2010
You can make use either of the below snippet inside your loop.

Code:
awk '/select|insert|update/ { _s=_s" "$0; f=1 } f==1{print} /;/ { f=0; } ' < file >sqlfile
# or,
perl -lane 'if (/select|insert|update/){ $str .= $_; $f=1 }print if $f==1;  $f=0 if /;/; ' < file >sqlfile


Last edited by dennis.jacob; 03-17-2010 at 05:28 AM.. Reason: Modified to handle the o/p redirection
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Processing a file in shell

I have a file which is having enrties like entry-id 1 ABC : value DEF :value GHI :VALUE entry-id 2 ABC : value DEF :value GHI :VALUE entry-id 2 ABC : value DEF :value GHI :VALUE and so on .. .wht i want to do is (1 Reply)
Discussion started by: msbinu
1 Replies

2. Shell Programming and Scripting

Two files processing

I have the following two files: 1st File: 1:1:100 2:101:400 3:401:450 4:451:600 5:601:980 6:981:1500 7:1501:1600 8:1601:1800 9:1801:2000 2nd File: 30 50 80 700 (2 Replies)
Discussion started by: moutaz1983
2 Replies

3. Shell Programming and Scripting

Processing files

Hi I have the folowing input file, the file looks like below sftp> . .. archive x001_ameint*.zip x001_ameint_1.zip x001_ameint_2.zip x001_REPORTS*.zip x001_REPORTS_1.zip sftp> I want my output to look like this x001_ameint*.zip x001_ameint_1.zip x001_ameint_2.zip (1 Reply)
Discussion started by: ramky79
1 Replies

4. Shell Programming and Scripting

KSH script -text file processing NULL issues

I'm trying to strip any garbage that may be at the end of my text file and that part is working. The problem only seems to be with the really long lines in the file. When the head command is executed I am directing the output to a new file. The new file always get a null in the 4096 position but... (2 Replies)
Discussion started by: geauxsaints
2 Replies

5. Shell Programming and Scripting

get all files from a directory and pass the files for processing

Hi All, I have a directory in which there will be several files. i want to get all the files and pass it to a piece of code for processing on the files. This is the piece of code which does the processing. tr "\n" "|" < (log file name) | tr "$" "\n" > output echo ' ' >>output while... (1 Reply)
Discussion started by: suresh_kb211
1 Replies

6. Shell Programming and Scripting

How to unzip files from folder in shell script (ksh)?

I have a folder (C:\shellprg\input\) containing .CSV, .zip, .gz files. 1] I want to find all .zip/.gz files from folder (C:\shellprg\input\). 2] unzip/uncompress files into the same folder (C:\shellprg\input\) through shell script. I am using below commands for unzip files, unzip <filename>... (2 Replies)
Discussion started by: Poonamol
2 Replies

7. Shell Programming and Scripting

ksh shell script to add date (YYYYMMDDHHMISS) to all .txt files in a folder

Everyday 15 files are written to a folder \app\where\thefiles\are\destined\CURRFOLDER Task1: I need to add date in YYYYMMDDHHMISS format to each of them. Example: File: ACCOUNT.txt Should be updated as: ACCOUNT_20101005175059.txt Task 2: After I update the files, they need to be ... (2 Replies)
Discussion started by: Duminix
2 Replies

8. Shell Programming and Scripting

Moving log files based on month - help with ksh shell script

Hello, I'm trying to move the log files from the parent directory to respective monthly folder and I would be running this script on a weekly basis through cron. I'm new to this scripting and here is what i could come up and it runs without really doing anything. I even tried placing echo... (2 Replies)
Discussion started by: jusblues
2 Replies

9. Programming

awk processing / Shell Script Processing to remove columns text file

Hello, I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this : This is the output of ls command : I stored the output in a file filelist 1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies

10. Shell Programming and Scripting

ksh processing options and parameters

I have a requirement where I need to process both options and parameters. command line call ie xxx.ksh -sid TEST1 -search_str LOCKED user1 user2 ..... I am using the following peice of code but I am usure how I can loop through all my parameters user1, user2, ... Note at the minium... (2 Replies)
Discussion started by: BeefStu
2 Replies
DR::Tarantool::SyncClient(3pm)				User Contributed Perl Documentation			    DR::Tarantool::SyncClient(3pm)

NAME
DR::Tarantool::SyncClient - sync driver for tarantool <http://tarantool.org> SYNOPSIS
my $client = DR::Tarantool::SyncClient->connect( port => $tnt->primary_port, spaces => $spaces ); if ($client->ping) { .. }; my $t = $client->insert( first_space => [ 1, 'val', 2, 'test' ], TNT_FLAG_RETURN ); $t = $client->call_lua('luafunc' => [ 0, 0, 1 ], 'space_name'); $t = $client->select(space_name => $key); $t = $client->update(space_name => 2 => [ name => set => 'new' ]); $client->delete(space_name => $key); METHODS
connect Connects to tarantool. Arguments The same as "connect" in DR::Tarantool::AsyncClient exclude callback. Returns a connector or croaks error. ping The same as "ping" in DR::Tarantool::AsyncClient exclude callback. Returns TRUE or FALSE if an error. insert The same as "insert" in DR::Tarantool::AsyncClient exclude callback. Returns tuples that were extracted from database or undef. Croaks error if an error was happened. select The same as "select" in DR::Tarantool::AsyncClient exclude callback. Returns tuples that were extracted from database or undef. Croaks error if an error was happened. update The same as "update" in DR::Tarantool::AsyncClient exclude callback. Returns tuples that were extracted from database or undef. Croaks error if an error was happened. delete The same as "delete" in DR::Tarantool::AsyncClient exclude callback. Returns tuples that were extracted from database or undef. Croaks error if an error was happened. call_lua The same as "call_lua" in DR::Tarantool::AsyncClient exclude callback. Returns tuples that were extracted from database or undef. Croaks error if an error was happened. COPYRIGHT AND LICENSE
Copyright (C) 2011 Dmitry E. Oboukhov <unera@debian.org> Copyright (C) 2011 Roman V. Nikolaev <rshadow@rambler.ru> This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License. VCS
The project is placed git repo on github: https://github.com/unera/dr-tarantool/ <https://github.com/unera/dr-tarantool/>. perl v5.14.2 2012-06-04 DR::Tarantool::SyncClient(3pm)
All times are GMT -4. The time now is 09:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy