Use this tag for questions about file management and operations on files.
0
votes
2answers
35 views
Replace numbers in file1 with corresponding line in file2
I have a file that looks like this
File 1
3 123456789
3 00000
2 123456789
2 abcde
1
4 abcdefgh
The lines in the first column correlate with the line number of another ...
2
votes
1answer
18 views
how to differentiate error returned while reading and for EOF in shell script
I have this task of uploading a delimited file and processing it. Once the processing is done, i either say its successful and if parsing fails, i need to throw the error. I'm reading this file line ...
0
votes
0answers
14 views
Files Just Go Missing On ext4 Partition within TrueCrypt
There are spooky things happening on one of my external hard drives. It's a 3 TB hard drive with:
one big partition taking up basically all the storage space there is,
and a pretty small partition ...
17
votes
5answers
2k views
Is it a UUOC (useless use of cat) to redirect one file to another?
If I want to make the contents of file2 match the contents of file1, I could obviously just run cp file1 file2.
However, if I want to preserve everything about file2 except the contents—owner, ...
4
votes
2answers
273 views
Unix Multiple Column Sort Issue
I am trying to sort a file:
TX001;A0004|Number|5|0|Y|1
TX001;A0110|VARCHAR|5|0|Y|4
TX001;A1332|VARCHAR|15|0|Y|3
TX001;B3321|VARCHAR|15|0|Y|5
...
0
votes
1answer
38 views
Opening .txt file when you open directory
Is it possible to automatically open *.txt file as you open certain directory on Ubuntu?
We have a school assignment to make a text file to pop up when you open certain directory. For example, when ...
1
vote
2answers
28 views
Remove file with pound signs around it [duplicate]
I am using SSH to another terminal with very limited disk space. upon typing ls I see a file called #korpus.txt#. I suspect this file is an emacs buffer, but upon running emacs and trying to kill it ...
0
votes
2answers
19 views
How to auto run script upon driver reboot?
I am trying to set an auto run on my shell script (named driver_check.sh) which will trigger upon rebooting the driver.
Basically, my script is as shown below:
#!/bin/bash
echo "Start script"
...
2
votes
1answer
31 views
Is there a way to create endless stream with custom character?
I need to create an endless stream of characters like /dev/zero but I need it to spam custom character (like 'a') instead of 0x00. Is there a way to do it?
10
votes
3answers
939 views
Why is it rm -rf and not rmdir -rf
I've always been curious why the command for deleting everything in a directory is rm -rf.
Why aren't there flags to do the same thing with rmdir?
Wouldn't it be more intuitive to use rmdir for ...
4
votes
2answers
54 views
Case … in, file type cases
I was given homework where I need to test if $1 is a file, special file or a folder in a Case $1 In statement.
I tried some things but wasn't able to make it work. Do you have any idea on how to ...
12
votes
5answers
699 views
mv: Move file only if destination does not exist
Can I use mv file1 file2 in a way that it only moves file1 to file2 if file2 doesn't exist?
I've tried
yes n | mv -i file1 file2
(this lets mv ask if file2 should be overridden and automatically ...
0
votes
0answers
33 views
Removing duplicates in a large text list
I've searched around the internet and stackexchange for this. Even though there are lots of similar topics, I haven't found a solution yet.
So, I have a quite large list (approx. 20GB), which ...
1
vote
0answers
26 views
Creating a sparse (automatically expanding and contracting) swap file with hole-punching support
I have this crazy idea, and want to know the pitfalls of such an approach (or whether it can even work with no deadlocks.. etc).
The goal is to create an automatically expanding and contracting ...
1
vote
4answers
137 views
How to sort files by part of the filename?
Given the files below:
ABC38388.SC01.StatueGrade_MKP
ABC38388.SC02.Statue_GKP
DEF38389.SC03.Statue_HKP
XYZ38390.SC00.Statue_WKP
How can I list them all based on the SC value, like this:
...