I want to replace only percent of occurrence of a pattern (not all, for example, half of occurrence of a pattern) in my text and it replaces randomly occurrences (or for example multiple of 3 occurrences).
for example, I have a text like below:
The text contains 20 a.
I want to replace half ofa (not whole of them) and randomly (not half of the first occurrences)
replace a to b and the result is something like below:
best regards
on my desktop i am using the kde rotating desktop image option. this rotates images randomly every half hour. now, i would like to write an html file which will have an inline frame with some text, maybe system messages, or my friends live journal thati read alot, or unix.com! however, i dont want... (1 Reply)
I have a directory of files that look like filename 001.ext, filename 002.ext, etc. I'd like to rename the files with unique random numbered names, so that the original filenames are stripped and the files are given a new, random number name. I'm not super new to UNIX, but I don't often use it for... (2 Replies)
Hi there!
I am really enjoying working with sed. I am trying to come up with a sed command to replace some occurrences (not all) in the same line, for instance:
I have a command which the output will be:
200.300.400.5 0A 0B 0C 01 02 03
being that the last 6 strings are actually one... (7 Replies)
I have a text (text.txt) and I would like to replace only the first 2 occurrences of a word (but I might need to replace more):
For example, if text is this:
CAR sweet head
hat red yellow
CAR book brown
tiger CAR cow CAR
CAR milk
I would like to replace the word "CAR" with word... (12 Replies)
I want to create a cron job randomly once a day for my site's registration.
The responsible file for registrations is a config file and I need to change the contents
twice on day (on and off)
I know the way for random cron job for example
*/n * * * * /usr/local/bin/php... (6 Replies)
Hi,
I tried to adapt bartus's solution to my problem, without success. I want to replace all the occurences of this:
with:
, where something can contain an arbitrary number of balanced parens and brakets.
Any ideas ?
Best, (1 Reply)
Hi,
(First post, please be gental!)
I have a java app that I am running on unix (centos)
But it keeps dying randomly. The times seem random from anything between 3 hours and 3 days.
I have a cronjob running to restart it when ever it dies but I would rather this happened less often.
... (2 Replies)
Hello,
This is my code:
nb_lignes=`wc -l $1 | cut -d " " -f1`
for i in $(seq $nb_lignes)
do
m=`head $1 -n $i | tail -1`
//command
done
Please how can i change it to get Get 20% of lines in File randomly to apply "command" on each line ? 20% or 40% or 60 % (it's a parameter)
Thank you. (15 Replies)
Hey,
How can i create randomly create time N times.
Suppose i want to create data for a particualr date 5 times...
Mon Jan 19 11:42:50
Mon Jan 19 19:16:40
Mon Jan 19 12:12:33
Mon Jan 19 14:26:27
Mon Jan 19 12:29:53
Mon Jan 19 13:30:31
I want the script to create N times randome... (2 Replies)
Discussion started by: jaituteja
2 Replies
LEARN ABOUT HPUX
dteditorchange
DtEditorChange(library call) DtEditorChange(library call)
NAME
DtEditorChange -- change one or all occurrences of a string in a DtEditor widget
SYNOPSIS
#include <Dt/Editor.h>
Boolean DtEditorChange(
Widget widget,
DtEditorChangeValues *findChangeStrings,
unsigned int instanceToChange);
DESCRIPTION
The DtEditorChange function replaces the next occurrence of a string, all occurrences of the string, or the currently selected text in a
DtEditor widget with a replacement string. The string to search for and the value to change it to can be the last values entered in the
Find/Change dialog (see DtEditorInvokeFindChangeDialog(3)) or passed as arguments to DtEditorChange.
The search begins at the insertion cursor. If the string is not found by the time the end of the document is reached, the search continues
at the beginning of the document, stopping at the character before the insertion cursor.
The widget argument specifies the DtEditor widget ID.
The findChangeStrings argument specifies the string to change and the replacement value. If findChangeStrings is NULL, DtEditorChange uses
the last string specified in the Find and Change To fields of the Find/Change dialog. If the instanceToChange argument is DtEDITOR_CUR-
RENT_SELECTION, the Find field of DtEditorChangeValues is ignored.
If the instanceToChange argument is set to DtEDITOR_NEXT_OCCURRENCE, DtEditorChange replaces the next occurrence (relative to the insertion
cursor) of the find string. If this argument is set to DtEDITOR_ALL_OCCURRENCES, all instances of the find string are changed. If this
argument ia set to DtEDITOR_CURRENT_SELECTION, the Find field of DtEditorChangeValues, is ignored and the currently selected text is
replaced.
For a complete definition of the DtEditor widget and its associated resources, see DtEditor(3).
For a complete definition of DtEditorChangeValues, see Dt/Editor.h - DtEditor(5).
RETURN VALUE
Upon successful completion, the DtEditorChange function returns True if the substitution occurred; otherwise, it returns False.
SEE ALSO
Dt/Editor.h - DtEditor(5), DtEditor(3), DtEditorFind(3), DtEditorInvokeFindChangeDialog(3).
DtEditorChange(library call)