Insert word in the middle of text for every multiples of 4sed - remove the very last occurrence of a string...
Tensorflow - logistic regrssion -oneHot Encoder - Transformed array of differt size for both train and test
Does norwegian.no airline overbook flights?
Is there any practical application for performing a double Fourier transform? ...or an inverse Fourier transform on a time-domain input?
Ensuring all network services on a device use strong TLS cipher suites
How should I face my manager if I make a mistake because a senior coworker explained something incorrectly to me?
Pythagorean triple with hypotenuse a power of 2
Does travel insurance for short flight delays exist?
Prove your innocence
What would be the challenges to taking off and landing a typical passenger jet at FL300?
How do I get toddlers to stop asking for food every hour?
Why does The Ancient One think differently about Doctor Strange in Endgame than the film Doctor Strange?
Is there any method of inflicting the incapacitated condition and no other condition?
Heyacrazy: Careening
Why did MS-DOS applications built using Turbo Pascal fail to start with a division by zero error on faster systems?
Algorithms vs LP or MIP
How to make Ubuntu support single display 5120x1440 resolution?
Is a player able to change alignment midway through an adventure?
How do I get a decreased-by-one x in a foreach loop?
Would the Republic of Ireland and Northern Ireland be interested in reuniting?
How much authority do teachers get from *In Loco Parentis*?
Numbers Decrease while Letters Increase
Couple of slangs I've heard when watching anime
Why doesn't 'd /= d' throw a division by zero exception?
Is there any way to keep a player from killing an NPC?
Insert word in the middle of text for every multiples of 4
sed - remove the very last occurrence of a string (a comma) in a file?how to insert backslash at the front of # symbol?How to add the content of a text file to the middle of another text filePrint text between two patterns not containing a particular wordExtract multiple instances of text between the same two lines of textsed code understanding for text processingInsert Newlines into serial stream before writing to text filesed: insert text after Nth character preceding/following a given stringHow can I use sed to insert some text after a multiline match?How to append a variable in a text file after a certain word?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Text:
exampleexampleexampleexample
Desired output:
exam$plee$xamp$leex$ampl$eexa$mpl$
I did this:
sed 's/[^*]/&$/4'
But it doesn't work, is there another way to do it?
sed
add a comment |
Text:
exampleexampleexampleexample
Desired output:
exam$plee$xamp$leex$ampl$eexa$mpl$
I did this:
sed 's/[^*]/&$/4'
But it doesn't work, is there another way to do it?
sed
1
answer to now deleted question:echo 'something' | sed 's/.{'$(( ( RANDOM % MAX) +MIN ))'}/&$/g'(replace MAX with a max number and MIN with min number); no you cannot easily revert that back if the$character was previously can find in your input else... | sed 's/$//g'
– αғsнιη
yesterday
Now it's work @αғsнιη thx 👍
– IISomeOneII
yesterday
add a comment |
Text:
exampleexampleexampleexample
Desired output:
exam$plee$xamp$leex$ampl$eexa$mpl$
I did this:
sed 's/[^*]/&$/4'
But it doesn't work, is there another way to do it?
sed
Text:
exampleexampleexampleexample
Desired output:
exam$plee$xamp$leex$ampl$eexa$mpl$
I did this:
sed 's/[^*]/&$/4'
But it doesn't work, is there another way to do it?
sed
sed
edited yesterday
IISomeOneII
asked yesterday
IISomeOneIIIISomeOneII
1321 silver badge13 bronze badges
1321 silver badge13 bronze badges
1
answer to now deleted question:echo 'something' | sed 's/.{'$(( ( RANDOM % MAX) +MIN ))'}/&$/g'(replace MAX with a max number and MIN with min number); no you cannot easily revert that back if the$character was previously can find in your input else... | sed 's/$//g'
– αғsнιη
yesterday
Now it's work @αғsнιη thx 👍
– IISomeOneII
yesterday
add a comment |
1
answer to now deleted question:echo 'something' | sed 's/.{'$(( ( RANDOM % MAX) +MIN ))'}/&$/g'(replace MAX with a max number and MIN with min number); no you cannot easily revert that back if the$character was previously can find in your input else... | sed 's/$//g'
– αғsнιη
yesterday
Now it's work @αғsнιη thx 👍
– IISomeOneII
yesterday
1
1
answer to now deleted question:
echo 'something' | sed 's/.{'$(( ( RANDOM % MAX) +MIN ))'}/&$/g' (replace MAX with a max number and MIN with min number); no you cannot easily revert that back if the $ character was previously can find in your input else ... | sed 's/$//g'– αғsнιη
yesterday
answer to now deleted question:
echo 'something' | sed 's/.{'$(( ( RANDOM % MAX) +MIN ))'}/&$/g' (replace MAX with a max number and MIN with min number); no you cannot easily revert that back if the $ character was previously can find in your input else ... | sed 's/$//g'– αғsнιη
yesterday
Now it's work @αғsнιη thx 👍
– IISomeOneII
yesterday
Now it's work @αғsнιη thx 👍
– IISomeOneII
yesterday
add a comment |
1 Answer
1
active
oldest
votes
To insert $ globally after four characters:
$ echo "exampleexampleexampleexample" | sed 's/.{4}/&$/g'
exam$plee$xamp$leex$ampl$eexa$mple$
The . matches one character and .{4} matches four of them. The replacement part &$ consists of the matched pattern & (four characters) and $. Using the g flag, the pattern is replaced globally (every four characters).
Thanks It's work @Freddy, could you explain it for me?
– IISomeOneII
yesterday
Okay, and if I want to revert back and delete that $? @Freddy
– IISomeOneII
yesterday
1
Reversed:echo 'exam$plee$xamp$leex$ampl$eexa$mple$' | sed 's/(.{4})$/1/g'
– Freddy
yesterday
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f536764%2finsert-word-in-the-middle-of-text-for-every-multiples-of-4%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
To insert $ globally after four characters:
$ echo "exampleexampleexampleexample" | sed 's/.{4}/&$/g'
exam$plee$xamp$leex$ampl$eexa$mple$
The . matches one character and .{4} matches four of them. The replacement part &$ consists of the matched pattern & (four characters) and $. Using the g flag, the pattern is replaced globally (every four characters).
Thanks It's work @Freddy, could you explain it for me?
– IISomeOneII
yesterday
Okay, and if I want to revert back and delete that $? @Freddy
– IISomeOneII
yesterday
1
Reversed:echo 'exam$plee$xamp$leex$ampl$eexa$mple$' | sed 's/(.{4})$/1/g'
– Freddy
yesterday
add a comment |
To insert $ globally after four characters:
$ echo "exampleexampleexampleexample" | sed 's/.{4}/&$/g'
exam$plee$xamp$leex$ampl$eexa$mple$
The . matches one character and .{4} matches four of them. The replacement part &$ consists of the matched pattern & (four characters) and $. Using the g flag, the pattern is replaced globally (every four characters).
Thanks It's work @Freddy, could you explain it for me?
– IISomeOneII
yesterday
Okay, and if I want to revert back and delete that $? @Freddy
– IISomeOneII
yesterday
1
Reversed:echo 'exam$plee$xamp$leex$ampl$eexa$mple$' | sed 's/(.{4})$/1/g'
– Freddy
yesterday
add a comment |
To insert $ globally after four characters:
$ echo "exampleexampleexampleexample" | sed 's/.{4}/&$/g'
exam$plee$xamp$leex$ampl$eexa$mple$
The . matches one character and .{4} matches four of them. The replacement part &$ consists of the matched pattern & (four characters) and $. Using the g flag, the pattern is replaced globally (every four characters).
To insert $ globally after four characters:
$ echo "exampleexampleexampleexample" | sed 's/.{4}/&$/g'
exam$plee$xamp$leex$ampl$eexa$mple$
The . matches one character and .{4} matches four of them. The replacement part &$ consists of the matched pattern & (four characters) and $. Using the g flag, the pattern is replaced globally (every four characters).
edited yesterday
answered yesterday
FreddyFreddy
6,6301 gold badge6 silver badges24 bronze badges
6,6301 gold badge6 silver badges24 bronze badges
Thanks It's work @Freddy, could you explain it for me?
– IISomeOneII
yesterday
Okay, and if I want to revert back and delete that $? @Freddy
– IISomeOneII
yesterday
1
Reversed:echo 'exam$plee$xamp$leex$ampl$eexa$mple$' | sed 's/(.{4})$/1/g'
– Freddy
yesterday
add a comment |
Thanks It's work @Freddy, could you explain it for me?
– IISomeOneII
yesterday
Okay, and if I want to revert back and delete that $? @Freddy
– IISomeOneII
yesterday
1
Reversed:echo 'exam$plee$xamp$leex$ampl$eexa$mple$' | sed 's/(.{4})$/1/g'
– Freddy
yesterday
Thanks It's work @Freddy, could you explain it for me?
– IISomeOneII
yesterday
Thanks It's work @Freddy, could you explain it for me?
– IISomeOneII
yesterday
Okay, and if I want to revert back and delete that $? @Freddy
– IISomeOneII
yesterday
Okay, and if I want to revert back and delete that $? @Freddy
– IISomeOneII
yesterday
1
1
Reversed:
echo 'exam$plee$xamp$leex$ampl$eexa$mple$' | sed 's/(.{4})$/1/g'– Freddy
yesterday
Reversed:
echo 'exam$plee$xamp$leex$ampl$eexa$mple$' | sed 's/(.{4})$/1/g'– Freddy
yesterday
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f536764%2finsert-word-in-the-middle-of-text-for-every-multiples-of-4%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
answer to now deleted question:
echo 'something' | sed 's/.{'$(( ( RANDOM % MAX) +MIN ))'}/&$/g'(replace MAX with a max number and MIN with min number); no you cannot easily revert that back if the$character was previously can find in your input else... | sed 's/$//g'– αғsнιη
yesterday
Now it's work @αғsнιη thx 👍
– IISomeOneII
yesterday