Sponsored Content
Top Forums Shell Programming and Scripting Using sed with a foreach loop Post 302279855 by Peggy White on Saturday 24th of January 2009 08:37:17 AM
Old 01-24-2009
Using sed with a foreach loop

THANKS! Absolutely wonderful! Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

foreach loop question

Hello, I am new at this forum so please bare with me on this. Within a given directory, I have a list of files in which in each file, I would like to do a substitution. I would like to substitute the string mlcl to mll in each file using the foreach command. I dont quite get how to do that. If... (7 Replies)
Discussion started by: clipski
7 Replies

2. Shell Programming and Scripting

Foreach loop

What am I doing wrong with this foreach loop? foreach var ($argv) @sum = $sum + $var (4 Replies)
Discussion started by: haze21
4 Replies

3. Shell Programming and Scripting

foreach loop

Hi Guys, I have a loop which uses a wildcard i.e. foreach f (*) but when I execute the tcsh file in unix then it gives me an error ->>>>>>>foreach: words not parenthesized<<<<<<<<<<- Any help. (1 Reply)
Discussion started by: abch624
1 Replies

4. Shell Programming and Scripting

foreach loop + 2 variables

In a foreach loop, is it possible for the loop to go through 2 arguments instead of one i.e. instead of foreach i (do stuff for i), we have foreach i j(do stuff for i; do stuff for j) I am working under BASH and TCSH shell environments cheers (3 Replies)
Discussion started by: JamesGoh
3 Replies

5. Shell Programming and Scripting

foreach loop

Hi everyone Does anyone know what is wrong with this script. i keep getting errors foreach filename (`cat testing1`) set string=$filename set depth=`echo "$string" echo $depth end the error is the following testing: line 1: syntax error near unexpected token `(' testing: line 1:... (3 Replies)
Discussion started by: ROOZ
3 Replies

6. UNIX for Advanced & Expert Users

Problem with foreach loop

Hi All, Is there any problem with the below 'foreach' loop? foreach risk_factor ($(cat "$rf_list")) where "rf_list=$SCRIPT/Utility/rflist.txt " I'm wondering, it is throwing below error message: syntax error at line 34: `(' unexpected Any idea/suggestions ? Thanks in advance /... (7 Replies)
Discussion started by: ganapati
7 Replies

7. UNIX for Dummies Questions & Answers

Using the Foreach loop, Needing help

I am trying to make a script for my Counter-Strike: Source servers. What i am wanting it to do is for it to restart each server, the only way i can think of doing this in through for each. Years what i have at the moment. server_start() { START=`ps x | grep SCREEN | grep $SRV | cut -d '?' -f... (5 Replies)
Discussion started by: grahamn95
5 Replies

8. Shell Programming and Scripting

foreach loop problem

Dear all, I wrote a script to download files and move files in directories according to their name. Now here is the problem: Both p101 and p360 data download successfully, but when I move them according to the year and month, only p101 data can be placed at the right location, p360,... (1 Reply)
Discussion started by: handsonzhao
1 Replies

9. UNIX for Dummies Questions & Answers

foreach loop in csh

Hi everyone I'm new to unix and encountered a small problem i couldnt find out a reason why it doesn't work..please help.. in my csh script when i tried to use the foreach loop like this: foreach x ( ls ) echo $x end when i tried to run it, it printed out 'ls' to the std out instead of... (3 Replies)
Discussion started by: ymc1g11
3 Replies

10. Shell Programming and Scripting

Foreach loop with two variables

I need to put together a script that will take the contents of two different files (database name and database owner) and put them in two variables within a line: foreach x (`cat /local/hd3/dba/tools/build_db_scripts/dbs`) foreach z (`cat /local/hd3/dba/tools/build_db_scripts/dbas`)... (6 Replies)
Discussion started by: deneuve01
6 Replies
DBIx::Class::Storage::DBI::MSSQL(3pm)			User Contributed Perl Documentation		     DBIx::Class::Storage::DBI::MSSQL(3pm)

NAME
DBIx::Class::Storage::DBI::MSSQL - Base Class for Microsoft SQL Server support in DBIx::Class SYNOPSIS
This is the base class for Microsoft SQL Server support, used by DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server and DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server. IMPLEMENTATION NOTES
IDENTITY information Microsoft SQL Server supports three methods of retrieving the IDENTITY value for inserted row: IDENT_CURRENT, @@IDENTITY, and SCOPE_IDENTITY(). SCOPE_IDENTITY is used here because it is the safest. However, it must be called is the same execute statement, not just the same connection. So, this implementation appends a SELECT SCOPE_IDENTITY() statement onto each INSERT to accommodate that requirement. "SELECT @@IDENTITY" can also be used by issuing: $self->_identity_method('@@identity'); it will only be used if SCOPE_IDENTITY() fails. This is more dangerous, as inserting into a table with an on insert trigger that inserts into another table with an identity will give erroneous results on recent versions of SQL Server. identity insert Be aware that we have tried to make things as simple as possible for our users. For MSSQL that means that when a user tries to create a row, while supplying an explicit value for an autoincrementing column, we will try to issue the appropriate database call to make this possible, namely "SET IDENTITY_INSERT $table_name ON". Unfortunately this operation in MSSQL requires the "db_ddladmin" privilege, which is normally not included in the standard write-permissions. Ordered Subselects If you attempted the following query (among many others) in Microsoft SQL Server $rs->search ({}, { prefetch => 'relation', rows => 2, offset => 3, }); You may be surprised to receive an exception. The reason for this is a quirk in the MSSQL engine itself, and sadly doesn't have a sensible workaround due to the way DBIC is built. DBIC can do truly wonderful things with the aid of subselects, and does so automatically when necessary. The list of situations when a subselect is necessary is long and still changes often, so it can not be exhaustively enumerated here. The general rule of thumb is a joined has_many relationship with limit/group applied to the left part of the join. In its "pursuit of standards" Microsft SQL Server goes to great lengths to forbid the use of ordered subselects. This breaks a very useful group of searches like "Give me things number 4 to 6 (ordered by name), and prefetch all their relations, no matter how many". While there is a hack which fools the syntax checker, the optimizer may still elect to break the subselect. Testing has determined that while such breakage does occur (the test suite contains an explicit test which demonstrates the problem), it is relative rare. The benefits of ordered subselects are on the other hand too great to be outright disabled for MSSQL. Thus compromise between usability and perfection is the MSSQL-specific resultset attribute "unsafe_subselect_ok". It is deliberately not possible to set this on the Storage level, as the user should inspect (and preferably regression-test) the return of every such ResultSet individually. The example above would work if written like: $rs->search ({}, { unsafe_subselect_ok => 1, prefetch => 'relation', rows => 2, offset => 3, }); If it is possible to rewrite the search() in a way that will avoid the need for this flag - you are urged to do so. If DBIC internals insist that an ordered subselect is necessary for an operation, and you believe there is a different/better way to get the same result - please file a bugreport. AUTHOR
See "AUTHOR" in DBIx::Class and "CONTRIBUTORS" in DBIx::Class. LICENSE
You may distribute this code under the same terms as Perl itself. perl v5.14.2 2011-05-10 DBIx::Class::Storage::DBI::MSSQL(3pm)
All times are GMT -4. The time now is 10:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy