Skip to main content

Questions tagged [sed]

Sed stands for Stream EDitor. It is one of the basic tools in the POSIX environment - it processes one or more files according to an editing script and writes the results to standard output. Created in Bell Labs, it has been around since mid-70s.

6 votes
3 answers
819 views

Linux file encryption using GPG key

In the below script I am using some arrays, and other Bash stuff, but I have made a minimal working example for you, where you cannot see those things. Anyway, I am interested in a review of the ...
Vlastimil Burián's user avatar
5 votes
1 answer
172 views

Script to format Markdown as plain text

The following script is to convert Markdown files to something closer to my aesthetical expectations. It is not assumed to be bulletproof accurate and I don't mind to slightly adjust the output ...
jsx97's user avatar
  • 207
4 votes
2 answers
229 views

Replace values in key=value configuration files

I have a handful of files containing simple configuration in which I need to modify values. There are some useful constraints that simplify my implementation: The file consists of single lines of ...
Toby Speight's user avatar
  • 88.3k
3 votes
2 answers
222 views

Processing a very long single line of comma-separated (?) floating point numbers

I have a sample svg file from the graphics program Inkscape. My objective is to collect every third pair from a very long line of floating point numbers. That seems simple enough. The larger objective ...
Bryan-StackExchange's user avatar
1 vote
1 answer
110 views

Changing file encoding, removing mid-line LF, and converting DOS CR-LF to Unix LF

We have several thousand large (10M<lines) text files produced by a windows machine. We need to change the file encoding of these files from cp1252 to ...
rxFt20's user avatar
  • 113
3 votes
1 answer
81 views

Split Text to Columns and move all data to the next column

Objective I'd like to confirm if there is a more efficient approach for the working script below, which splits column data in my tsv files. I suspect this can be achieved with awk or maybe sed but my ...
El_Birdo's user avatar
  • 131
3 votes
1 answer
105 views

Bash script to clone directory structure with renaming

I've written a script to aid in creating new watchfaces for the awesome AsteroidOS project. A watchface there typically consists of directory structure like this: ...
Edward's user avatar
  • 67.2k
1 vote
1 answer
147 views

Bash script syncronizing yaml and asciidoc headers using sed

I have a bash script that fixes or creates, and syncs the asciidoc attributes and yaml header for blog posts. It does what it is supposed to. But notice I have put ...
Boyd's user avatar
  • 111
1 vote
1 answer
89 views

Grabbing resolution and offset from xrandr

(using GNU sed) I want to grab some output from xrandr and leave out everything but the resolution and offset. Input: ...
AlpGlide3's user avatar
5 votes
1 answer
70 views

Listing my StackEchange communities user id

Extending this answer solution, I've wrote the following bash script to get the html of my StackExchange accounts page and parse it to a YAML file. The objective ...
artu-hnrq's user avatar
  • 285
2 votes
0 answers
195 views

Bash wrapper for connmanctl with autocompletion

So the idea came from the fact that connmanctl only completes filenames/directories when used non-interactively, whereas when used interactively (executing ...
Enlico's user avatar
  • 531
4 votes
2 answers
235 views

Bash code to install bootstrap in a Ruby on Rails repository

Wrote some code to install bootstrap (latest) in a newly created rails application. update: fixed a typo ...
american-ninja-warrior's user avatar
1 vote
1 answer
502 views

Sed script to update a version number in an RPM SPECS file

I have a specs file: Name: program Version: 2.3.3 Release: 0 ... I want to update the version number every time it's built. I perform the ...
Zhro's user avatar
  • 239
3 votes
1 answer
122 views

Bulk File Rename

A function that funnels all filenames into a file and opens that file in vim. The user then changes the names, saves, and quits. Finally the function renames the files in the folder with the new names ...
user avatar
5 votes
1 answer
557 views

sed to fix a messy nginx.conf

I have a few servers to fix that repeatedly get their nginx.conf file messed up due to a rogue deploy script. These are the three sed commands I'm using to fix at present: ...
mar627's user avatar
  • 53

15 30 50 per page