Linked Questions

4 votes
4 answers
8k views

I want to write a bash script that takes my file: READ_ME.MD two three four and makes it READ_ME.MD one two three four There are a bunch of similar StackOverflow questions, but I tried their ...
c_idle's user avatar
  • 1,684
1 vote
2 answers
1k views

In bash script, if I do this: cat infile >> outfile the content of "infile" is added from the last line of "outfile". infile: foo bar outfile: superfoo superbar after cat command: superfoo ...
acgbox's user avatar
  • 335
0 votes
2 answers
542 views

Real nit picky Linux question. I have a text file, call it userec. I also have a string variable 'var_a'. I want to concatenate the string value, let just say it's 'howdy' to the top of the text file....
Carbon's user avatar
  • 333
0 votes
0 answers
49 views

I have a basic bash script to generate a file conversion with pandoc. After the file conversion I want to add a text header (jekyll darkmatter) before the first line. #!/bin/bash # Pattern #sed -i &...
Kandinski's user avatar
  • 983
780 votes
9 answers
1.4m views

I want to read a file and save it in variable, but I need to keep the variable and not just print out the file. How can I do this? I have written this script but it isn't quite what I needed: #!/bin/...
kaka's user avatar
  • 8,005
22 votes
4 answers
14k views

Greetings, how do I perform the following in BSD sed? sed 's/ /\n/g' From the man-page it states that \n will be treated literally within a replacement string, how do I avoid this behavior? Is there ...
Brett Ryan's user avatar
  • 28.4k
4 votes
2 answers
2k views

I saw there were several good answers for bash and even zsh(i.e. Here). Although I wasn't able to find a good one for fish. Is there a canonical or clean one to prepend a string or a couple of lines ...
Paiusco's user avatar
  • 379
0 votes
1 answer
1k views

I'm using Deployer and enjoy it. One thing I haven't figured out how to do yet though is write a log file of my deployments. I'm attempting to append the commit hash and date to revisions.txt: task(...
Ryan's user avatar
  • 24.5k
2 votes
3 answers
473 views

I want this, the sed solution looks good, but when I tried it seems to create a huge temp file. unix command to prepend text to a file I have big sql file that is like 28 gigs, I dont have much ...
Joelio's user avatar
  • 4,691
6 votes
2 answers
188 views

I am looking for a gem or elegant way to setup system where I would be able to see where certain HTML content came from. I am working on a big project, and a lot of my times goes determining where a ...
Haris Krajina's user avatar
1 vote
1 answer
378 views

I want to run a SSH command using a cron and I want to extent this cron by adding autocommit=0 So that auto commit is disabled. How can I achieve this? Command: mysql dbname -u dbuser -p'password' ...
JGeer's user avatar
  • 1,852
0 votes
1 answer
187 views

We have in code one-liner used to add header to file. It looks like perl -pi -e 'print "name, function, group\n" if $. == 1' CSV_FILE_NAME Everything is fine except when CSV_FILE_NAME is ...
Bartosz Górzyński's user avatar
0 votes
1 answer
153 views

I have been given a 15 GB .txt file that is formatted like this: { "_score": 1.0, "_index": "newsvit", "_source": { "content": " \u0641\...
lydal's user avatar
  • 950