sed's questions - English 1answer

3.882 sed questions.

Suppose I have a python script, which normally would be executed as python s.py Instead of having to type data in manually, I'd like to forward a file, text.txt, as an input: python s.py < text....

I am currently working with data of many merged .csv files. Unfortunately, those merges are faulty sometimes. This is best explained by this example: "var1", "var2", "var3", "var4", "var5" "...

I wanted to apply changes to config file with SED command, it requires inserting some lines in a few places after starting tags. However, when I've tried: sed '/\[httpd/\]/a secure_rewrites = false; ...

I've been looking around sed command to add text into a file in a specific line. This works adding text after line 1: sed '1 a\ But I want to add it before line 1. It would be: sed '0 a\ but I get ...

CLASS RECORD OF THE STUDENT FROM THE PREVIOUS BATCH WHO TOPPED Name (Roll no) # Location Section Rank (MARKS) Gender Anna (+) USA A1 First (100) Female (...

I have a poem with an unknown number of rows and I want to display only the penultimate one. What command should I use?

I have a text file which has following content DESCRIPTION ENABLED Tracker_EG32747257_0418_0618, {NAME => d, DATA_BLOCK_ENCODING => NONE, BLOOMFILTER => ROW, REPLICATION_SCOPE => 0, ...

I have one Configuration file with section wise data, as mentioned below. Using shell script accessing each variable. I am using sed command for that, Now I facing one problem like if I forget to ...

I have a partition image that contains a 1MB file populated with random data, and I would like to replace the contents of that file with another 1MB file populated with different random data. I have ...

I have a list of split CSV files. How can I copy the first CSV header to the rest of CSV files? profiles00.csv profiles01.csv profiles02.csv profiles03.csv ... This is what I have now but how do I ...

How can I use / in sed to find and replace as a normal / and not a special charatcer.

I have a file with few lines . File_Name : test.sql INSERT INTO ADJUSTMENT_REASON VALUES (17-MAY-18,,'','','','S','C','Y','N',,'Y','N','N','A','BAN','Y','B','Mobile Internet Discount','N','','','N','...

Hello i want make a script to comment at specific moment #a6712376789 aeaasdfsdgf asdffdgjf anfth #v1781289123 #8765123ha71 kldfgnkajfb xcmbvnkzv zxjvb #9054123h273 #a64464v79870 poiyghjf okjfcjnh ...

This works perfectly well on any Linux : $ echo foo bar | sed -n '/foo/{/bar/{;p;}}' foo bar But fails on OSXs ancient BSD variant : ❯ echo foo bar | sed -n '/foo/{/bar/{;p;}}' sed: 1: "/foo/{/...

file:- "h1" "north" "street_12" "bus" "west" "asdf" "apb" "hhh" "edf" "box" "choco_late" "pen" 1. Count number of words in quotes " " and append at the beginning of each word in the line with its ...

I have a string like: func showFetchNextSliceFailed(result: UserResult<[Product]>) { From this, I would like to 1). extract just showFetchNextSliceFailed 2). Insert it right above the given ...

Typing /usr/bin/env sed -f in terminal works. But if use it as a shebang, #!/usr/bin/env sed -f s/a/b/ The script will be fail to execute: /usr/bin/env: sed -f: No such file or directory I kind ...

how can I use sed to report any first record that is not of size 21 in a file? I don't want sed to scan the complete file and get out as soon as the first record which is not of size 21 is found.

I have this file, I want to print all the lines that are not of size 21. PASY$ type a.a 000008050110010201NNN 000008060810010201NNN 21212000008070110010201NNN 000008080310010201NNN ...

I have 3 files file1: compute-0-44 compute-0-2 compute-0-7 compute-0-8 file2: 0 11/29/2017 | 02:01:34 0 05/16/2018 | 08:47:56 file3: 0 963 0 459 When I do paste file1 file2 file 3, I get : ...

sed's capture grouping ALTERNATION is not working as expected. While alternation has the lowest precedence, here is the confusion: echo "abcd_aefghi" | sed -r "s/(a)(b)(c)(d)|(a)(e)(f)(g)/\8/g;" ...

I want to decode URL encoding, is there any built-in tool for doing this or could anyone provide me with a sed code that will do this? I did search a bit through unix.stackexchange.com and on the ...

I want to insert a new line in two lines before the last line. So if my original file is: 1 2 3 4 5 The result should be 1 2 3 New line 4 5

I need to reformat the output of the following command using awk for static and dynamic column numbers: ps -eopid,lstart,cmd | grep java |grep -v grep following would be sample input to the awk ...

I want to read one part of one line from a file. For example: POP3_SERVER_NAME = localhost I want to return only localhost, using sed. This text is on the third line. I do this to extract the ...

I'm writing a bash script which will isolate a portion of a string and save it to a variable in a bash script. Assuming $INSTALL_INFO is a variable with the file I wish to pull data from, I'm doing ...

Question more or less says it all. I'm aware that /^$/d will remove all blank lines, but I can't see how to say 'replace two or more blank lines with a single blank line' Any ideas?

I am building Linux From Scratch. Here's the error I faced during installation of sed. /tools/bin/install: cannot create regular file '/tools/bin/sed': Permission denied Because of this I cannot ...

Today I've come across this command for extracting domain name from domain controller's FQDN: DOMAIN_NAME=$(echo $DC_PC | sed -r 's!^[^.]+\.!!') What is the meaning of these exclamation marks in sed?...

Need help parsing 2 files

1 answers, 40 views linux sed xml
I'm trying to parse 2 Microsoft Office files called v64.hash and VersionDescriptor.xml. Keep in mind that the contents of the files will change with every Microsoft Office update. I would like to: ...

I found line sed 's~ ~~g' in a shell script on a Linux system. What is this ~?

I have a huge file with about 12300 lines that look something similar to this. 001.domain.com=001.somedomain.com:10001 002.domain.com=002.somedomain.com:10002 003.domain.com=003.somedomain.com:10003 ...

In vim I can use... :g/match/-1d ...several times to delete more than one line from before a match... ...and combine it with a few calls to... :g/match/+1d ...to delete more than one line after ...

cut only date and time (i.e.05-09-2018-10.13) from below string /pi_nfs/pixin/axpin-zhgahh/was_logs/was_admin_logs/start_WPS.log.05- 09-2018-10.13:ADMU4000I: Server Node_axpin-...

I thought I knew my way around a for loop using sed, I guess not! I wrote a small script that will recursively go through all *.py files within a directory and replace specific entries in the files. ...

I have a CSV file with 150+ columns, with the new line character as a record separator. The problem lies in one of the columns getting new line characters. For this, I want to remove those. Input: ...

I need to remove the first two characters of every line in a file ( always the same ) and the last "/" if it is present. Input is, in the file F1 : ^./inst/oracle/ ^./tmp/ ^./inst/maj/ ^./mkcd ^./...

I want to search for characters in file and replace with file containing contents: search for ktr_updater in file and replace with file contents from another file using Unix commands. sed -i 's/...

Can anyone please explain how does the below sed command works to print a paragraph? Command: sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;' file If possible can anyone explain by breaking this command into ...

Related tags

Hot questions

Language

Popular Tags