sed Questions
8
Solved
I'm trying to get trim off trailing decimal zeroes off a floating point number, but no luck so far.
echo "3/2" | bc -l | sed s/0\{1,\}\$//
1.50000000000000000000
I was hoping to get 1.5 but some...
Akilahakili asked 4/5, 2015 at 15:21
3
Solved
I'm trying to add a column (with the content '0') to the middle of a pre-existing tab-delimited text file. I imagine sed or awk will do what I want. I've seen various solutions online that do appro...
5
Solved
I am using sed command to insert an xml element into the existing xml file.
I have xml file as
<Students>
<student>
<name>john</>
<id>123</id>
</studen...
4
Solved
2
Solved
I need to find in files (xml) date in this format 2021-06-25T21:17:51Z and replace them with this format 2021-06-25T21:17:51.001Z
I thought about using regexp with sed but back references does not ...
Olympus asked 24/1, 2022 at 18:29
3
Solved
7
Solved
I have a file with an identifier and a value:
ABC123 111111
ABC123 111111
ABCDEF 333333
ABCDEF 111111
CCCCCC 333333
ABC123 222222
DEF123 444444
DEF123 444444
Both columns contain duplicate values,...
8
Solved
I have pattern like below
hi
hello
hallo
greetings
salutations
no more hello for you
I am trying to replace all newlines with tab using the following command
sed -e "s_/\n_/\t_g"
but it's not...
4
I have a text file and I want to remove all lines containing the words: facebook, youtube, google, amazon, dropbox, etc.
I know to delete lines containing a string with sed:
sed '/facebook/d' myf...
5
Solved
I have nearly 200 files and I want to find lines that are common to all 200 files,the lines are like this:
HISEQ1:105:C0A57ACXX:2:1101:10000:105587/1
HISEQ1:105:C0A57ACXX:2:1101:10000:105587/2
HIS...
7
Solved
I have three types of strings that I'd like to capitalize in a bash script. I figured sed/awk would be my best bet, but I'm not sure. What's the best way given the following requirements?
single ...
9
Solved
I'm trying to do the opposite of this question, replacing Unix line endings with Windows line endings, so that I can use SQL Server bcp over samba to import the file. I have sed installed but not d...
Prearrange asked 5/10, 2009 at 18:30
5
Solved
I have written a Makefile which works fine; I am just posting the part of it under investigation:
BUILD_PRINT = @echo -e "\e[1;34mBuilding $<\e[0m"
COMPILE_cpp = $(CXX) $(CFLAGS) -o $@ -c $<...
3
Solved
I have an entire directory structure with zip files. I would like to:
Traverse the entire directory structure recursively grabbing all the zip files
I would like to find a specific file "*myLostF...
8
Solved
For grep there's a fixed string option, -F (fgrep) to turn off regex interpretation of the search string.
Is there a similar facility for sed? I couldn't find anything in the man. A recommendation ...
22
Solved
I want to add a newline at the end of a file only if it doesn't exist. This is to prevent multiple newlines at the end of the file.
I'm hoping to use sed.
Here are the issues I'm having with my cur...
5
Solved
Recently I rewrote my program to find English words that are made of chemical symbol abbreviations, for example "HErSHeY". I came up with this dynamic regex:
grep -Pi "^($(paste -s -...
Hypsography asked 4/5, 2024 at 0:34
4
Solved
I'm trying to replace a single line in a file with a multiline string stored in a variable.
I am able to get the correct result when printing to screen, but not if I want to do an in-place replacem...
4
Solved
I'm confused by the two concepts in sed: hold space and pattern space. Can someone help explain them?
Here's a snippet of the manual:
h H Copy/append pattern space to hold space.
g G Copy/append...
5
Solved
I have the following bash script which repeats for each image found. It needs to iterated over all html, css and js files, and replace all occurrences of an image within that file.
for image in a...
15
Solved
I have a Windows batch file I'm creating, but I have to ECHO a large complex string, so I'm having to put double quotes on either end. The problem is that the quotes are also being ECHOed to the fi...
Behnken asked 29/4, 2009 at 22:56
4
Solved
I need to make an automatic bump of package.json in jenkins, and really stuck with it.
The following sed command works in a pipeline but it changes the second field, I need to change the third on...
9
Solved
I want to delete one or more specific line numbers from a file. How would I do this using sed?
Evidential asked 21/1, 2010 at 20:8
1
I'm using turbo feature called turbo prune which creates folder out with partial copy of my monorepo, but unfortunately that means that when running in GitHub Actions commands like turbo run ...
9
Solved
I have a new Ubuntu 12.04 VPS. I am trying to write a setup script that completes an entire LAMP installation. Where I am having trouble is appending a line to the /etc/hosts file. My current hosts...
1 Next >
© 2022 - 2025 — McMap. All rights reserved.