Sponsored Content
Full Discussion: Search & Replace
Top Forums Shell Programming and Scripting Search & Replace Post 302656567 by fretagi on Friday 15th of June 2012 02:18:56 AM
Old 06-15-2012
Another problem is that I have to change that in 30000 files Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

vi search & replace functions

I'm trying to do a global search and replace in vi. I am trying to replace a string, call it "BOB" with a carriage return and can't seem to find a reference to it. Command syntax s%/BOB/???/g What would I substitute the "???" with? (7 Replies)
Discussion started by: barnettdk
7 Replies

2. Shell Programming and Scripting

Search & replace

Is there any way we can achieve search & replace with awk? I could achieve the same with sed in following way - sed 's/A/B/g' file1 > file2 But the same regex if I try with using awk following way, awk 's/A/B/g' file1 > file2 it gives me Syntax error. I strongly believe I am... (1 Reply)
Discussion started by: videsh77
1 Replies

3. Shell Programming and Scripting

search & replace in variable

Can I use search & replace in any variable? Suppose I have one variable named var1 which holds value "abcabc" I need to search 'a' in var1 and want to replace with 'x' like 'xbcxbc'. Is it possible? Can you provide me an example? Malay (3 Replies)
Discussion started by: malaymaru
3 Replies

4. UNIX for Dummies Questions & Answers

String Search & Replace

Hey, I want to have a C program which, for an existing file supplied by the command line argument (E.g. File1.txt) replaces all the occurrences of the words: "We” or “we” by “I” “a” by “the” “A” by “The”. Then print the replaced file. All other characters of the file are to be left... (1 Reply)
Discussion started by: IwishIknewC
1 Replies

5. Shell Programming and Scripting

Need help with search & replace

I have a file that has some accent characters in it when viewed in some text editors, but when viewed in vi they come in as ~R and ~U. I need to make a script to remove these characters from the file, but have been unsuccessful. I am not sure how sed or awk, or something similar is viewing them,... (8 Replies)
Discussion started by: tcovert
8 Replies

6. UNIX for Dummies Questions & Answers

Search & Replace

Hi , I ahve a text file which has several instances of the text such as run_time: 09:30 I need to add double quotes before and after the time value i.e: run_time: "09:30" Any suggestions on how to go about the same (4 Replies)
Discussion started by: jobbyjoseph
4 Replies

7. Shell Programming and Scripting

Stuck with Search & Replace

Hi I'm trying to replace a string in the files ending with *.txt Unable to get the sed to do the job. any help would be appreciated :) I'm on SunOS #!/bin/bash startdirectory={$HOME}/pp_test searchterm="change" replaceterm="CHANGE" echo $searchterm echo $replaceterm for file in... (4 Replies)
Discussion started by: mqueue
4 Replies

8. Shell Programming and Scripting

Search & Replace question

Hi all, I have one question that hopefully isn't too complicated for the more advanced users here. In one of the Solaris KSH scripts I'm working on, is it possible to script the following: - If there "is" an empty blank line "at the end" of /tmp/text.txt, then remove only that one empty... (3 Replies)
Discussion started by: chatguy
3 Replies

9. Shell Programming and Scripting

search & replace pattern

Hi, My problem is that I have to search a changing pattern and replace it with the wild card char "*" i/p: 99_*_YYYYMMDD_SRC.txt.tar.gz o/p: 99_*_*_SRC.txt.tar.gz The problem is that YYYYMMDD pattern is not static. It could be YYYYMMDDHHMI or could be YYYYMMDDHHMISS. Can... (10 Replies)
Discussion started by: dips_ag
10 Replies

10. Shell Programming and Scripting

Search & Replace

Hi Gurus, I have two files. I want to read sessoin_name from the file1 and replace $Param4 & $Param5 in file2 with connection_name in specified in file1. The file1 will have data in following format File 1 session_name,connection_name s_abcd,Listener_2 s_def,Listener_1 source file... (7 Replies)
Discussion started by: r_t_1601
7 Replies
RANDOMID(3)						   BSD Library Functions Manual 					       RANDOMID(3)

NAME
randomid randomid_new, randomid_delete, -- provide pseudo-random data stream without repetitions SYNOPSIS
#include <sys/types.h> #include <randomid.h> uint32_t randomid(randomid_t ctx); randomid_t randomid_new(int bits, long timeo); void randomid_delete(randomid_t ctx); DESCRIPTION
The randomid() function provides pseudo-random data stream, which is guaranteed not to generate the same number twice during a certain dura- tion. ctx is the context which holds internal state for the random number generator. To initialize a context, randomid_new is used. bits specifies the bitwidth of the value generated by randomid(). Currently 32, 20, and 16 are supported. timeo specifies the reinitialization interval in seconds. timeo has to be bigger than RANDOMID_TIMEO_MIN. randomid_new returns a dynamically-allocated memory region allocated by malloc(3). randomid_delete() will free(3) the internal state ctx. The same number may appear after two reinitialization events of the internal state, ctx. Reinitialization happens when the random number generator cycle is exhausted, or timeo seconds have passed since the last reinitialization. For instance, ctx configured to generate 16 bit data stream will reinitialize its internal state every 30000 calls to randomid() (or after timeo seconds), therefore the same data will not appear until after 30000 calls to randomid() (or after timeo seconds). The internal state, ctx, determines the data stream generated by randomid(). ctx must be allocated per data stream (such as a specific data field). It must not be shared among multiple data streams with different usage. EXAMPLES
#include <stdio.h> #include <sys/types.h> #include <randomid.h> uint32_t genid(void) { static randomid_t ctx = NULL; if (!ctx) ctx = randomid_new(16, (long)3600); return randomid(ctx); } ERRORS
randomid_new() returns NULL on error and sets the external variable errno. SEE ALSO
arc4random(3) HISTORY
The pseudo-random data stream generator was designed by Niels Provos for OpenBSD IPv4 fragment ID generation. randomid() is a generalized version of the generator, reworked by Jun-ichiro itojun Hagino, and was introduced in NetBSD 2.0. BSD
January 5, 2006 BSD
All times are GMT -4. The time now is 11:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy