Sponsored Content
Top Forums Shell Programming and Scripting Please help: Build a sed command and execute it in a script Post 302216205 by zaxxon on Friday 18th of July 2008 07:58:05 AM
Old 07-18-2008
You have that input file text1.txt. Run the sed command on the shell onto it 1st without redirecting it to an outputfile. Just test this, then start redirecting it, if it works.
And please use the tags [ c o d e ] and [ / c o d e ] to have your code more eyefriendly for us, ty Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to build a command into a string rather than execute the command

I'm trying to populate a command line into a variable. It appears to be executing, instead. Here's an example: mycmd='' if ...; then $mycmd='sudo ' fi $mycmd=$mycmd 'sed -i prev s/aaa/bbb/' $myfile res=`$mycmd` (I'm also not sure of the best way to execute the command from the... (1 Reply)
Discussion started by: littlejon
1 Replies

2. Shell Programming and Scripting

how to execute a sh command from a csh script

Hi everyone, I have a csh script that works fine but the output of an rsh command is different if I use boune shell instead cshell. Is there the possibility to execute only this command in bourne shell from a script declared cshell? Thanks Christian (2 Replies)
Discussion started by: bonovox
2 Replies

3. Shell Programming and Scripting

How to build a command in a script

Hi All I am trying to build a script that will take data from a tab separated file and use that to split up a quicktime file. So far the code is as follows #!/bin/sh #test parsing of data #fix excel file output returns cat $1 | tr "\r" "\n" > $1.fix printf "\n" >> $1.fix mv $1.fix $1 ... (3 Replies)
Discussion started by: babajuma
3 Replies

4. Shell Programming and Scripting

exec a build command (adduser) in a script

Hi, With a awk script i create a "adduser line" $ cat /tmp/tmp.ldif | awk -f ldif2adduser.awk adduser --uid 1002 --gid 1000 --gecos "ROUSSIN Guy" --home /homeL/guy --shell /bin/bash --disabled-password guy If i cut and paste this line, all is fine. But in a shell script i get errors : ... (2 Replies)
Discussion started by: guyr
2 Replies

5. Shell Programming and Scripting

Execute sed altered script

Man...no one answered my last two posts...Oh well, so hey guys i have a script that i'm wanting to put a # on a certain line, and then execute the script but not write it to the script. So far I'm doing it the dirty way with: sed -i -e "s/^rm/\#rm/" -e "s/^tar/\#tar/" /path/to/file ... (3 Replies)
Discussion started by: DC Slick
3 Replies

6. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

7. Shell Programming and Scripting

Script runs but does not execute rm -rf command

Hi! First off I'm no bin/bash script writer! :( I can make heads and tales of it from the php experience I have and that's all. Now I managed to piece this script together to go look at directory and remove files that are +60 days. It's finding the files but its not removing them. I... (11 Replies)
Discussion started by: MrBiggz
11 Replies

8. Shell Programming and Scripting

Build.xml invocation by Build Script

Hi I have a build.xml file and I can run it on Windows via cmd. Now I want to write a script to invoke the same. Is there a way to do this? (1 Reply)
Discussion started by: ankur328
1 Replies

9. Shell Programming and Scripting

sed working on command line but file unchanged when execute with Shell script

I have a simple task to replace unix line feed end of line characters with carriage returns. When I run the following “change file in place” sed instruction from the command line all the Line feeds are successfully replaced with Carriage returns. sed -i 's/$/\r/' lf_file.txt But that same... (1 Reply)
Discussion started by: hawkman2k
1 Replies

10. Shell Programming and Scripting

Execute ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies
1'

ns_cache(3aolserver)					    AOLserver Built-In Commands 				      ns_cache(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
ns_cache - Cache arbitrary data SYNOPSIS
ns_cache append cachename key string ?string ...? ns_cache create cachename ?-size maxsize? ?-timeout timeout? ?-thread thread? ns_cache eval cachename key script ns_cache flush cachename key ns_cache get cachename key ?varname? ns_cache incr cachename key ?value? ns_cache lappend cachename key string ?string ...? ns_cache names cachename ?pattern? ns_cache set cachename key string _________________________________________________________________ DESCRIPTION
AOLserver implements a C API for caching arbitrary data. This module provides a Tcl API on top of the C API. A cache, in this context, is simply a dictionary that maps keys to values. Keys are always stored as NUL-terminated strings. How values are stored depends on the type of cache. ns_cache create cachename ?-size maxsize? ?-timeout timeout? ?-thread thread? This command creates a new cache named cachename. If -thread is given and is true, then it is a thread-private cache. Otherwise it is a global cache. If maxsize is given, then it is a sized-based cache. If timeout is given, then it is a timeout-based cache. Oth- erwise, it is a timeout-based cache with an infinite timeout, meaning it will never be flushed. This command returns nothing if it is successful. ns_cache eval cachename key script This command atomically sets and gets a cache value. First, it looks up key in the cache named cachename. If it finds an entry, it returns the value of that entry. Otherwise, it executes script, stores the return value in the cache, and also returns that value. Script may optionally use the return command to return its value. For example, this will store the value "2" in mycache, if mykey is not already present: ns_cache eval mycache mykey { expr {1+1} } This will also store the value "2" in mycache: ns_cache eval mycache mykey { return [expr {1+1}] } If script raises an error, or exits with break or continue, then ns_cache eval simply returns the same condition without modifying the cache. ns_cache flush cachename key This command removes the entry for key from the cache named cachename. If the cache has no entry for key, then nothing happens. For global caches, ns_cache flush interacts with ns_cache eval. Suppose thread 1 has called get_thing A and is executing the long operation to compute the value for A. Thread 2 calls get_thing A and starts waiting for thread 1 to finish. Thread 3 calls ns_cache flush thing_cache A. Thread 1 will continue executing the long operation, but thread 2 will also start the long operation. When thread 1 completes the long operation, ns_cache eval returns the (now stale) value it computed, but it does not store the value in the cache. When thread 2 completes the long operation, ns_cache eval stores the (fresh) value it computed in the cache and returns the fresh value. ns_cache get cachename key ?varname? This command looks up key in the specified cache. It operates differently depending on whether varname was given. If varname absent and the key exists the value is returned and if the key is missing an error is raised. If varname is provided and the key exists the command sets varname to the value and returns 1, otherwise it returns 0. ns_cache names cachename ?pattern? This command returns a list of all keys currently in the specified cache. If pattern is specified, only matching entries are returned (match pattern syntax like in string match). If the cache is thread-private, then the list only includes keys that are in the thread's private cache. ns_cache set cachename key value This command stores value for key in the specified cache. CACHE TYPES
ns_cache supports three types of caches: Global Size-Limited Cache ns_cache create cachename -size maxsize Entries in a cache of this type are accessible to all threads. Each cache has its own mutex that protects access to its entries. Cache values are stored as counted strings, so arbitrary binary data can be cached. A global cache stores strings instead of Tcl objects to prevent race conditions that could lead to heap corruption. The cache has a maximum size specified when the cache is created. The size of the cache is the sum of the sizes of all the values in the cache; keys do not count toward a cache's size. If inserting a value into the cache makes the cache's size exceed its maximum, then cache entries are evicted starting with the least-recently used entry until the size is below the maximum size (or until only the new value remains in the cache). Global Time-Limited Cache ns_cache create cachename -timeout timeout Entries in a cache of this type are accessible to all threads. Each cache has its own mutex that protects access to its entries. Cache values are stored as counted strings, as in a global size-limited cache. The cache has a maximum entry lifetime, called its timeout, specified (in seconds) when the cache is created. Every timeout seconds, AOLserver flushes all cache entries that have not were not created or accessed in the last timeout seconds. Thread-Private Size-Limited Cache ns_cache create cachename -size maxsize -thread 1 Each thread in AOLserver automatically gets its own private cache named cachename. Since a thread-private cache is only accessed by one thread, access to it does not require a mutex. Entries in one thread's cache are not visible to any other thread. Cache values are stored as Tcl objects. When a value is stored in the cache, nscache computes its string form and uses the length of the string as the size of the value. The cache has a maximum size, like a global size-limited cache. However, because of the way the cache value sizes are computed, the actual memory usage of the cache values may be several times larger than maxsize. Thread-private caches may offer higher performance if the cached values are complex objects such as lists or scripts, but require more storage than global caches. SEE ALSO
Ns_Cache(3), nsv(n) AOLserver 4.0 ns_cache(3aolserver)
All times are GMT -4. The time now is 10:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy