Linked Questions

29 votes
4 answers
2k views

Using gawk -i inplace some-awk-code some-file (or @include "inplace" within an awk script) to edit a file in-place (or any other extension) is a security vulnerability. Why? How do I work ...
Stéphane Chazelas's user avatar
7 votes
1 answer
33k views

Hi i am trying to replace the header line from my file using the sed command as mentioned below, sed "1s/.*/$new_header/" Test_file.csv The above line replaces the header and prints in stdout , But ...
William R's user avatar
  • 609
3 votes
3 answers
6k views

I have a tab-separated file that looks like this: $ cat in_file NC_013132.1 7260299 7261429 WP_012793281.1 NC_013132.1 7270674 7270862 NC_013132.1 7270674 7270862 ID=cds5678 NC_013132.1 ...
BhushanDhamale's user avatar
0 votes
4 answers
2k views

I want to delete a specific line of a file in bash. What I am currently doing is to get the line number and pass it so sed to delete this line: awk '/qr/{ print NR; exit }' test | sed -i "${1}d" ...
Itération 122442's user avatar
0 votes
1 answer
5k views

Say I have a column of data like this: sample123 sample456 samplexyz I can easily add two new columns using: sed -i "s/$/\t1.1\tC/" <file.txt> Now it's: sample123 1.1 C sample456 1.1 C ...
Luther_Blissett's user avatar
1 vote
4 answers
933 views

We want to comment the specific line in fstab file that contained the relevant UUID number Example: Disk=sde UUID_STRING=` blkid | grep $Disk | awk '{print $2}' ` echo $UUID_STRING UUID="...
yael's user avatar
  • 14k
0 votes
5 answers
652 views

I've parsed a file but there's some issue and a quick way around is to replace empty line with line below it so how do I do that like the folowing file apple banana big sig cake should convert to ...
vib_29's user avatar
  • 114
0 votes
3 answers
1k views

I need to remove all http and https from txt file. Like this: http://ac.tecnicasdeinvasao.com http://go.tecnicasdeinvasao.com http://lp.tecnicasdeinvasao.com https://ac.tecnicasdeinvasao.com http://...
Lucas Fernandes's user avatar
0 votes
4 answers
2k views

I have a file with about 7 million lines which looks like this: head gokind_SNPs.txt 1:753541:G:A 1:769223:C:G 1:771967:G:A 1:778745:A:G 1:779322:A:G ... How do I remove everything after the 2nd ...
anamaria's user avatar
  • 121
3 votes
3 answers
2k views

I can't seem to find a command that lets me delete duplicates in my file without creating a new file and also preserving the order of the contents in my file. Would there be another command besides ...
Nathan's user avatar
  • 39
0 votes
2 answers
1k views

I'm using sed to do the following: Match pattern (eg: line starting with #) Substitute match (eg: substitute the # char at the start to nothing/remove it) Print to stdout (eg: print the resulting ...
secemp9's user avatar
  • 2,502
0 votes
2 answers
1k views

I would like to delete all tab-delimited columns from a text file in which the header (first line) contains the string "_HET". The input text file looks like this: rs36810213_HET rs2438689 ...
mitch's user avatar
  • 35
1 vote
5 answers
238 views

How could I copy digits from one end of a string to another end of a string? So example, Input - Example123:Hello Exp12:Hey1 Exp:heylo expected output - Example123:Hello123 Exp12:Hey112 Exp:heylo I'...
user357075's user avatar
0 votes
3 answers
1k views

I am generating a CSV file which ideally should have 1-row or 2-row data but it is coming like 11,ABC,3,4,5,6 ,,,,, I have tried sed and awk commands to remove that empty row but it didn't work out ...
Mayank Parihar's user avatar
0 votes
1 answer
988 views

Currently I am working on a folder of files, and each file have some lines as follows: abcde fghij abcde fghij jklmn pqrst ..... ..... These lines have a specific line length 43. At the ...
Frown's user avatar
  • 197

15 30 50 per page