Skip to content
Advertisement

Tag: sed

Replacing string with variable with Groovy and SED command

I am trying to replace an entire description string contained in an XML file. I would like to replace that string with a variable. I am using a SED command within a Groovy script. I have the following code. I am expecting the string “foo” to replace the description text but it doesn’t. Instead the following line causes the XML

Using SED to convert sensors command output to a loggable entry

Consider the following sensor command output: I’m trying to turn this into a log entry, like this, where the “temp1” values are placed next to the PCI adapters, and the board (it8721-isa-0290): I think sed is the correct tool for this, but if it’s not please let me know. I have already trimmed some data out using 2 sed commands,

How to add text at the end of each line after skipping Last N characters

I’m on Linux command line and I have log file with following content I want to add date before Time Stamp for every line Answer Something like this: sed -r “s/([0-9]+{1}:[0-9]+{1}[A-Z]{2}.*$)/01 Oct 2016 1/g” test.txt > new.txt Where text.txt is your log file and “01 Oct 2016 ” is your text and the 1 is the time inserted back in

getting the output of “find” in a CSV

I’ve got a project where I’m trying to collect all the files on a linux system into a CSV to be dumped into a DB. my script has But the problem is that I have filenames %f and directory names %h with commas in them. So then I thought I could just put each item in quotes and that won’t

Advertisement