Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How do I reduce the size of a file using tail?
I just need the last 1000 lines of the file. I need the trimmed file name to remain the same.
tail -1000 file.txt
To make a new file
tail -1000 file.txt > newfile.txt
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I was wondering how to delete the first 196 lines of multiple html documents with sed.
The directory structure I have goes as follows:
find /rootdir/ -name index.html -exec sed -i '1,196d' {} \;
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have 1 file where data gets added every 10 min, I want to get updated data which can be stored in new file(inc1.txt) through script.
My path for file as /home/asda/Desktop/inc.txt
How this can be achive?
Use tac to cat the file backwards, and quit when you get to your marker:
tac /home/asda/Desktop/inc.txt | sed /Marker/q | tac
then add a new Marker at the end to remember where you last finished
echo "Marker" >> /home/asda/Desktop/inc.txt
This has the disadvantage that it alters your file, but you can grep out the markers when you use the file like this:
grep -v Marker /home/asda/Desktop/inc.txt
Of course, you should make the marker something that doesn't naturally occur in your file.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a file containing many lines like
"resourcename" : "myfile.pdf",
I want to replace everywhere myfile.pdf with an URL like http://somedomain.com/myfile.pdf. But the file name keeps changing. So if myfile.pdf becomes yourfile.pdf, I want to replace it with http://somedomain.com/yourfile.pdf.
What is an efficient way to do global replacement(/g) without affecting the file's encoding like UTF-8?
Thanks
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need a shell script that should remove the matched pattern .
Can anyone please help me ?
The command is
sed -i -e '/yourpattern/d' your_file
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have an ip-address stored in a file. I want to use a single-line command to output the ip-address from this file and then ssh log in this remote machine.
How can I get it with pipe.
If you have a file that says
# cat test
192.168.32.205
then just do:
ssh root#$(cat test)