I have a file, with some HTML in it.
I would like to make a shell/bash script that moves ALL of the content of that file into ANOTHER HTML file at a CERTAIN line number...
Does anyone have any suggestions?
If not possible at a certain line, then at the END of the file.
# put it at the end
cat tomove.html >> toreceive # note >>, not >
There are a variety of ways to put it at a particular spot in the file. You will need a temporary file to hold either the original torecieve or the new one. Lets assume you will build into the temporary and then rename it.
# put it after line 25
head -25 torecieve> tempreceive
cat tomove.html >> tempreceive
tail +26 toreceive >> tempreceive # note the plus sign
mv toreceive old-toreceive
mv tempreceive toreceive
Or you could use sed ... with the r (read file here) command. Similar pattern: Work from existing file into a temp file, then rename.
Either the script or with sed, you could instead first rename the original file to a tempame, then build the new file in place. If this fails, though, it is harder to get back to the initial state.
Not at all: head -25 gives you the first 25 lines, and tail +26 gives you everything from line 26 onward. Don't think 'head minus twentyfive', think 'head dash twentyfive': it is a flag (use line 25). The head command is ancient, and does not quite conform to what is now standard practice for unix utilities. Similarly for tail.
If you are satisfied that your issue is solved, please be sure to mark it with the 'solved' button. Thanks.,
**how to solve invalid keystore error in android studio here is error report----------------------->
here is error report--------> error:Error:java.lang.RuntimeException: com.android.ide.common.signing.KeytoolException: Failed to read key palash from store "D:\MyApplication3.idea\workspace.xml": Invalid keystore format ...