• How can I separate a file with columns 1-7 of data into ONE column with all the data in order? 2019-03-22

    For example, I have all of this data but i want it organized in a way such that the output file is purely numbers, with rows 1-7 corresponding to columns 1-7, then rows 8-14 corresponding to columns 1-7 on the second row, and etc. Can I do this using

    Tags: bash, awk, sed
  • Using quotes on a sudo encapsulated sed command already using quotes 2019-02-06

    I have a shell script, where I want to change the following text in a JSON file: "foo-bar": true to this: "foo-bar": false I want to do this by using the sed command. However, the JSON script resides in my /etc directory. Therefore, I

    Tags: shell, linux, json, sed, sudo
  • Template variable replacements only. Is text/Template a good fit? 2018-10-22

    I'm looking for an efficient way to replace a bunch of placeholders/tokens in a user supplied text file, with their corresponding values stored in a simple map or environment vars. The thing is that the template file will be supplied by the end user,

    Tags: python, awk, sed, go templates
  • SED find line with first pattern then insert a line before line with second pattern 2018-08-15

    Sample file1: //MODIFICATIONS: //comment //comment // </IF> Sample file2: MODIFICATIONS: comment without leading // comment without leading // </IF> Sample file3 MODIFICATIONS: comment without leading // comment without leading // </IF>

    Tags: sed
  • Concatenate/merge columns 2018-08-13

    File( ~50,000 columns) A1 2 123 f f j j k k A2 10 789 f o p f m n Output A1 2 123 ff jj kk A2 10 789 fo pf mn I basically want to concatenate every two columns into one starting from column4. How can we do it in awk or sed? --------------Solutions---

    Tags: awk, sed, concatenation
  • awk filter rows by column 2018-08-04

    This is my row. 2706 abc/efe/efefe/fefe 10143 fefef/dbddf/fvfvdf/vdfvdp 8927 fvdfv/fvdv/fvdfv/fvdfv 11546 fvsddfv/fdfvdv/fvddffv/fvddfv expected output 2706 abc/efe/efefe/fefe 10143 fefef/dbddf/fvfvdf/vdfvdp 8927 fvdfv/fvdv/fvdfv/fvdfv . . . . 11546

    Tags: awk, grep, cut, sed
  • Replace multiline text in file using regex on Linux 2018-05-21

    I need to replace multiline text in config file. I can use sed (BusyBox v1.21.1), perl (revision 5 version 14 subversion 2) or python (2.7). The file can have two formats: A) "is_managed": false, "local_profile_id": 15191724, "nam

    Tags: regex, perl, python, sed
  • Sed wildcard replace 2018-05-02

    I am not sure why I am having a hard time with this, I have this SQL file: insert into table_name values ('Danny:2:1429543183', 195621, 'My Stuff', '', 'Fake', '', '', 0, 1429553870, 1429543183, 1429543183, 1429543183, 0, 1, 1, 0, 0, '', 0, 0, 0, 0,

    Tags: replace, sed, wildcard
  • Linux CLI change price (awk or sed?) 2018-03-14

    I have price strings formatted as $25.00 in various html files. I would like to use the Linux command line (BASH, presumably with awk or sed) to increase each price by a certain dollar amount ($3 in this case). In short, I need to find $nn.00 and rep

    Tags: regex, linux, bash, awk, sed
  • sed: replace multiple patterns, but not with the same string 2017-12-09

    is it possible to change multiply patterns to different values at the same command? lets say I have A B C D ABC and I want to change every A to 1 every B to 2 and every C to 3 so the output will be 1 2 3 D 123 since I have 3 patterns to change I woul

    Tags: bash, sed
  • perl - Extract data using grep and sed 2017-11-12

    I'm using this code to get all titles from urls with http://something.txt: #!/usr/bin/perl -w $output = `cat source.html | grep -o '<a .*href=.*>' | grep -E 'txt' | sed -e 's/<a /\n<a /g' | sed -e 's/<a .*title="//' | cut -f1 -d '"

    Tags: perl, grep, html parsing, sed
  • Print last "window" with sed 2016-11-12

    I have a log to process that's roughly structured like this: ... ... sentinel marker ... marker ... sentinel marker ... I want everything between a marker and the following sentinel, and I want the last such "window." The following works ok: sed

    Tags: sed
  • Bash script display results in a specific order or sequence 2016-06-12

    I've tried various solutions via sed awk and array manipulation ((in bash)), but have not found a solid way to make the following happen: Let's say I have a file named states.txt containing: Alabama Alaska Arizona Arkansas California Colorado and so-

    Tags: arrays, bash, awk, sed, cat
  • bash replace string with floating variable 2016-05-31

    Im trying to replace a number in a file with a calculated floating variable in a bash file. So im trying to replace 1.1111 with the value of "km" and save it in the file. I keep getting an error on the sed line, I think there may be an i

    Tags: bash, awk, sed, floating
  • Bash replace '\n\n}' string in file 2016-04-07

    I've got files repeatedly containing the string \n\n} and I need to replace such string with \n} (removing one of the two newlines). Since such files are dynamically generated through a bash script, I need to embed replacing code inside the script. I

    Tags: regex, perl, bash, awk, sed
  • bash script to replace all occurrences of placeholders in file 2016-02-29

    I'm trying to write a bash script to replace all occurrences of a placeholder in a file with an environment variable of the same name. As an example, if I have a file like the following... This is an {{VAR1}} {{VAR2}}. It should work across multiple

    Tags: linux, bash, awk, sed
  • Using sed on specific fields or columns 2015-09-30

    I have a file with fields that are separated with colons (These are all fake numbers/names btw so no need to worry about confidentiality). What I want to accomplish is to make the last column look more like a money value i.e. have thousand separators

    Tags: unix, sed
  • linux logfile to pandas dataframe 2015-09-15

    Hi I have the following logfile: log.file The data is like this: [string;int;string,string2;int2;string2] [string3;int3;string3,string4;int4;string4] I need to get it in a pandas dataframe like this: string int string string2 int2 string2 string3 int

    Tags: python, sed, pandas
  • convert hex values to decimal in a text file 2015-03-13

    I have a text file which looks like this: RAM_SIZE 3128 RAM_ADDRESS_WIDTH 0xF MTFE 0xF IPS_ADDR_WIDTH 314 I want to convert hex values to decimal and display something like: RAM_SIZE 3128 RAM_ADDRESS_WIDTH 15 MTFE 15 IPS_ADDR_WIDTH 314 I tried with a

    Tags: bash, awk, sed
  • String substitution in unix (awk,,cut-) 2015-03-13

    I've a huge sql_text string. I want substitute in the whole string/file the occurences of :1, :2, :3 and so on with :b1, :b2, :b3, and so on. I've tried sed -e "s/\(.\)\(.\)/\1b\2/" but it doesn't work for the WHOLE string. --------------Solutions---

    Tags: unix, sed

Copyright (C), All Rights Reserved.

processed in 2.544 (s). 9 q(s)