Tagged Questions
1
vote
2answers
91 views
Merge chunks from multiple files
I need to merge chunks from a few but large files. Each line contains the file name and byte offsets.
# file begin end
foo/a 11970 12010
foo/a 22995 23035
foo/b 45090 45130
foo/b ...
2
votes
1answer
248 views
Create sub-directories and organize files by date
I have some directories of files copied from my security camera that I would like to organize into sub-directories by file date. So for example;
-rwxrwxrwx 0 root root 4935241 Jul 19 2012 ...
1
vote
1answer
96 views
reading from a file and changing its pattern into an array?
I have a CSV file containging entries like this :
ipaddress,VLAN,VLANid
10.192.168.1,vlan-xyz,3
10.192.168.1,vlan-abc,8
10.192.168.1,vlan-mnp,11
10.192.163.24,vlan-llz,3
10.192.163.24,vlan-bbz,5
...
1
vote
1answer
133 views
File is readable by everyone, but I can't open the file
I'm fairly new to Unix and I have written a script:
SERVER="/usr/local/abc/.../somefile.txt"
OPTION="$1"
if [ x$OPTION = "xtitle" ]
then
grep $OPTION $SERVER
exit
fi
As far as I ...
3
votes
4answers
100 views
Unix - how to fetch files based on the part of a filename that is date
Say I have files say like
AA_XX_20111208
AA_XX_20111207
AA_XX_20111206
AA_XX_20111205
AA_XX_20111204
AA_XX_20111203
So using the date part,
how can i fetch previous 2 month files ?
For e.g. this ...
1
vote
1answer
344 views
Reading the contents of the file and splitting using ksh
We're using a ksh script for installing one product.
I've another config file, I'd need to read this configuration file from my main script
Content of the Configuration file:
...
2
votes
1answer
103 views
Distributing thousands of files over subfolders
I have a folder A with hundreds of thousands of files. I would like to move these files to new subfolders S_i, with, say, 100 files in each (the last folder may have less than 100 files)
In other ...
1
vote
1answer
126 views
Outputting last modification date to another file?
I'm trying to read the number of lines in a file, and the last modification date of that file (e.g. if it was last modified Jan 18, 2013, it should output 2013-01-18), then append the data to the ...
0
votes
1answer
261 views
Shell script to delete all files which are older [duplicate]
Possible Duplicate:
Deleting files by age
Write a shell script to delete all the files which are "n" of older that current day, where n can be 3days. 2days, or 1 year etc. The above script ...
0
votes
2answers
83 views
file command + how to view all results from file command
I use the file command in order to verify if file (PATH) is text/ascii file or encrypted file
Because file command have allot of results ( small example in example 1 )
I want to get the all ...
0
votes
1answer
88 views
linux/solaris + manipulation of Standard Output
I run the following line on linux/solaris machine ( all output will write in to /tmp/Log from application.bin )
./application.bin 1>>/tmp/Log
We can see the content of the /tmp/Log file
...
1
vote
1answer
245 views
How to move files with same name and concatenate
My directory structure is given below. I need to move all the folders from Test3 to Test2 and concatenate the files with same names
[jg@hpc Test2]$ tree
.
|-- Sample_1008
| |-- ...
2
votes
4answers
522 views
Get the newest file from directory structure year/month/date/time
I store backups of databases in a directory structure
year/month/day/time/backup_name
an example would be
basics_mini/2012/11/05/012232/RATIONAL.0.db2inst1.NODE0000.20110505004037.001
...
2
votes
2answers
135 views
Create a new link to access all files and folders
I get stuck to create a shell script for a new link something like that
link linkPathName orginalPathName
I want to create a link between a new link and original path; however, both can access ...
2
votes
2answers
193 views
How to make duplicates with different names from a single file? [closed]
I want to duplicate the contents of a file. Suppose there is a file named "Hydrogen.element". I want to duplicate the contents of this file with a different name ie.make another file named ...
4
votes
1answer
73 views
Transform directory structure
I have the following folder structure
root folder
|-al2
|- GER.zip
|- ENG.zip
|-ww
|- GER.zip
|- ENG.zip
and so on. The folder names are random strings.
I want to sort the files in ...
1
vote
1answer
1k views
Move huge number of files into date structured directory order
I have about 1 million files in this directory: /home/username/images/
Each of the files are called something like: 012345678910(Place)_0_20120414185957_28841.jpg with the timestamp part of the ...
2
votes
3answers
425 views
Can I list only specific subdirectories?
I have a folder tree structure like
arndell
\_databases
\_daily
\_weekly
claremont
\_databases
\_daily
\_weekly
monte
\_databases
\_daily
\_weekly
and I am only after all files inside ...
4
votes
3answers
4k views
File extensions for unix shell scripts
On wikipedia, the article for .sh says:
For the .sh file extension type, see Bourne shell.
How about other unix shells?
I know that the shebang is used inside the file to indicate an ...
8
votes
1answer
153 views
How to start tailing a file that has not been yet created
I use tail to monitor the progress of jobs that I know will write their progress to disk. Almost always, I know which file they will create before they start running (the jobs are dispatched by a ...
6
votes
6answers
4k views
Shell script for moving oldest files?
How do I write a script for moving just the 20 oldest files from one folder to another? Is there a way to grab the oldest files in a folder?
3
votes
3answers
295 views
Delete files in a directory which are also in another directory
I copied a directory using this:
cp -r dir/ ../../
without thinking and realized that it copied the contents of dir instead of actually dir to the above directory. Now I have a mess of files I need ...
9
votes
2answers
768 views
How can I delete all files in a folder that haven't been accessed in a certain amount of time?
I'd like to run a nightly cron job that deletes all the files in a folder that haven't been accessed in a week or more. What is the most efficient way to do this in bash?
1
vote
2answers
458 views
Creating an empty file having a variable name in a script
I need to create an empty file using a shell script. The filename will be determined by examining all the files in a directory matching a pattern, say TEST.*, and appending _END to it so that the new ...