Finding In Wrong Order So Cat Is Messed Up

hi guys,

thanks in adv for looking through the long winded post...

i'm trying to cat a bunch of text files together into one, but i'm running into problems and i think it's because of how 'find' is working, but i'm not really sure. here's the command i'm using


Code:
find . -name '*.dat' -exec cat {} \; > out.txt

my data structure looks like

dir1
f1.dat
f2.dat
f3.dat
f4.dat
f5.dat
f6.dat
f7.dat
f8.dat
f9.dat
f10.dat
dir2
f1.dat
f2.dat
f3.dat
f4.dat
f5.dat
f6.dat
f7.dat
f8.dat
f9.dat
f10.dat
dir3
f1.dat
f2.dat
f3.dat
f4.dat
f5.dat
f6.dat
f7.dat
f8.dat
f9.dat
f10.dat
dir4
f1.dat
f2.dat
f3.dat
f4.dat
f5.dat
f6.dat
f7.dat
f8.dat
f9.dat
f10.dat
dir5
f1.dat
f2.dat
f3.dat
f4.dat
f5.dat
f6.dat
f7.dat
f8.dat
f9.dat
f10.dat
dir6
f1.dat
f2.dat
f3.dat
f4.dat
f5.dat
f6.dat
f7.dat
f8.dat
f9.dat
f10.dat
dir7
f1.dat
f2.dat
f3.dat
f4.dat
f5.dat
f6.dat
f7.dat
f8.dat
f9.dat
f10.dat
dir8
f1.dat
f2.dat
f3.dat
f4.dat
f5.dat
f6.dat
f7.dat
f8.dat
f9.dat
f10.dat
dir9
f1.dat
f2.dat
f3.dat
f4.dat
f5.dat
f6.dat
f7.dat
f8.dat
f9.dat
f10.dat
dir10
f1.dat
f2.dat
f3.dat
f4.dat
f5.dat
f6.dat
f7.dat
f8.dat
f9.dat
f10.dat

so I "think" in my cat'd file I'm getting the order like this,

dir1f1
dir1f10
dir1f2
dir1f3
dir1f4
dir1f5
dir1f6
dir1f7
dir1f8
dir1f9
dir2f1
dir2f10
dir2f2
dir2f3
dir2f4
dir2f5
dir2f6
dir2f7
dir2f8
dir2f9
etc....

but maybe it's even worse than this, idk


Similar Content



Chown Question For Subdirectories

I have a directory structure and files I wish to change permissions on, but I don't want to change permissions on every file/subfolder along the way. Example: I want to chown all files in dir4 where my directory struture is:
/dir1/dir2/dir3/dir4/*
However, both dir3 and dir4 are owned by root:root so I need to change the ownership on those directories as well. But, if I do:
chown -R user:group /dir1/dir2/dir3/dir4/
...it will indeed make dir4 and it's files accessible, but it doesn't change dir3 - so folks still can't get to the files they need. I thought about doing:
chown -R user:group /dir1/dir2/dir3*
... but that will give users access not only to dir4 and it's files, but any other files under dir3 which I don't want.

My work around has been to do a chown on /dir1/dir2/dir3 and then a second chown on /dir1/dir2/dir3/dir4/, but I am thinking there has to be a way to do what I want in a single chown command - right?

Extract Info And Find/count Strings From Blocks Inside Text File

Hello

I have a text file which has blocks like
Code:
dir1/dir2/dir3/name_run_number1:
line1_run_number1_part1
line2_run_number1_part2
line3_run_number1_part3...

Each block is separated with a blank line and there is the ":" in the "header" of each one while each block carries the same "number1" after "run_" suffix
What I want to do is for each block, extract the "number1" as shown in the first line and then for the lines below count from 1-20 and give a message if a "partX" line is missing. Any bash or python would be fine

Thanks

Diffing The Line Numbers

hi guys

i am trying to find the "size" of a "block" of data in LARGE data files, the example below test_data.txt is very simplified. by "size" i mean the difference in line numbers of a block, and the "size" will be constant throughout the file so

1234 6.600000 4321
1234 8.500000 4321
1234 1.800000 4321
1234 2.300000 4321
1234 8.500000 4321
1234 2.800000 4321

if i define a block as whenever i find 8.500000 in the second column, then in the example the the block size would be 3 becasue 8.500000 occurs on the 5th line and on the 2nd. right now i am using

Code:
 grep -n "8.500000" test_data.txt | cut -f1 -d:

and/or

Code:
 awk '/8.500000/ {print FNR}' test_data.txt

obviously i don't remeber how to tag text as code?

btw, the grep command is much much faster

both of these commands give an entire list (long list of number for files greater than a gig) of line numbers which i then have to subtract one from another to come up with 3 in the example. not that i'm opposed to doing math, but i would think awk or grep should be able to do this for me

ideas?

tabby

Please Explain How This Read Command Works

Hi All,

I am new to linux and I am finding difficulties in understanding the below commands.

Please explain what is happening in the below commands.

Code:
IFS="~"
exec 4< $BCP_DIR/cnts.data
while read -ru4 TableName Count CreationDateTime Type AccessDate
do
        . /apps/rmb/prod/scripts/load_datasum.ksh
done
IFS=" "
exec 4<&-


Please explain how this commands flows especially
exec 4< $BCP_DIR/cnts.data & exec 4<&-

Find 30 Days Old And Delete Prints Error Msg File Not Found After Deleting It

I have a shell script to find folders which are 25 days older and delete it, and put the deleted folder details into log file like this

Code:
 find /ahome/xxx/$FOLDER -type d -mtime +25  -exec ls -ld {} \;  -exec rm -rf {} \;  >> mylogfile.log

after running this command it deletes the folder and logs the folder deleted. But also print error msg
Code:
find: /ahome/prksh/dir/test: No such file or directory

How to suppress the error msg

Is It Food Have Find Command Running In Cron Every Day Once To Delete Older Files

I need to clean-up some folder. I have a cron job which uses find command to find and delete 25 days older file.

Code:
find $FOLDER_PATH/$FOLDER -depth -regex  ^$FOLDER_PATH/$FOLDER/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ -type d -mtime +25  -exec ls -ld {} \;   >> /tmp/deleted_folders.log

When this running it occupies 1-3% of cpu. And it may take longer time based on the folder size.

Is it ok to have find command running as cron job ?

Mount Error 115 On Some Shares

Hi there guys,

I hope you can help me with a small issue that is kinda driving me crazy.
I'm running debian wheezy on a virtual machine and trying to mount some shares from the win8.1 host.
The lines I put in the /etc/fstab a
Code:
//192.168.0.10/dir1 /home/user/dir1 cifs credentials=/root/.secret.pwd,uid=1000,gid=1000,file_mode=0777,dir_mode=0777,iocharset=utf8,sec=ntlm 0 0
//192.160.0.10/dir2 /home/user/dir2 cifs credentials=/root/.secret.pwd,uid=1000,gid=1000,file_mode=0777,dir_mode=0777,iocharset=utf8,sec=ntlm 0 0
//192.160.0.10/dir3 /home/user/dir3 cifs credentials=/root/.secret.pwd,uid=1000,gid=1000,file_mode=0777,dir_mode=0777,iocharset=utf8,sec=ntlm 0 0

The first share gets mounted correctly, but not the other two.
This is the output I get when sudo-ing a mount -a:
Code:
mount error(115): Operation now in progress
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
mount error(115): Operation now in progress
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

and this is what /var/log/syslog shows:
Code:
Mar 24 12:56:12 hostname kernel: [ 1887.029043] CIFS VFS: Error connecting to socket. Aborting operation
Mar 24 12:56:12 hostname kernel: [ 1887.030013] CIFS VFS: cifs_mount failed w/return code = -115
Mar 24 12:56:22 hostname kernel: [ 1897.052130] CIFS VFS: Error connecting to socket. Aborting operation
Mar 24 12:56:22 hostname kernel: [ 1897.053885] CIFS VFS: cifs_mount failed w/return code = -115

The same happens at boot time.

Now, the crazy thing is that if I run manually a:
Code:
sudo mount //192.168.0.10/dir2 /home/user/dir2 -t cifs -o credentials=/root/.secret.pwd,uid=1000,gid=1000

it works perfectly.

Now, I'm no power user, but I thought I'd be able to manage a couple of simple cifs shares...but then again I guess not
So, my questions so far a
1. how the heck do I make that work?
2. why is it not working? Might be the security? Should I choose perhaps ntlmv2? I read a bit around but I don't know this kind of security mechanisms, so...
3. why on earth is the first mount working just like a charm and not the other two?

You know what? I'm trying now to remove the sec option from the fstab, and see how that works out.

In the meantime, if anyone could lend a hand I'd appreciate it very much

How To Use Static Libraries? Please Help Lol

https://code.google.com/p/wavelet1d/...ar.gz&can=2&q=

The above link is where I downloaded *.cpp(s) and the libraries.

If you "untar" the package, in "examples" directory, there are some demonstration files. What I wanted to do was to make an executable file out of "wavedemo1.cpp".

I modified the code in "wavedemo1.cpp"; Code:
#include "wavelet2d.h"

to Code:
#include "wavelet2s.h"

, then placed the header file "wavelet2s.h" (from /wavelib/src/linuxstatic) and the modified "wavedemo1.cpp" into my working directory.

Inside the working directory, I ran the following command

Code:
gcc -L/home/mario/wavelet/wavelib/linuxstatic -lwavelet2s wavedemo1.cpp -o wavedemo1

Then I get the following error messages.

/usr/bin/ld: skipping incompatible /home/mario/wavelet/wavelib/linuxstatic/libwavelet2s.a when searching for -lwavelet2s
/usr/bin/ld: cannot find -lwavelet2s
collect2: error: ld returned 1 exit status

I'm not sure what went wrong with my approach. This is my first time trying to use libraries on linux and it's giving me really tough times.

I would appreciate your help, please let me know if you need more details to explain things.

Thanks.

File Copy With Netcat Missing

Hi everyone

long story short

i copied a file using netcat from one server to another but the file is not in the location it should be.

Curently i have a "find" command running in order to get the file but the disk is 3Tb and will take ages till it finds it.

Is there any other way i could figure out where this file is?

Can i repeat the copy procedure with netcat and while the copy is in progress to find out where the file is? maybe with some sort of "lsof"

Maybe verbosing netcat?

Thanks

Ubuntu Directories

Hi there. I have Ubuntu 14.04 installed. Actually I have been doing a lot of work in this OS for about a year. The thing I cannot still comprehend is how to find files I installed. In this particular case I need glut.h for g++ compiler. So I go here, do this command;

Code:
sudo apt-get install freeglut3-dev

And find out that I already have the newest version (which I have suspected since I recall installing it).

So, the next step is to find the glut.h file and reference it with #include command. I cannot find it anywhere. This website says it has to be he

Code:
/usr/lib/x86_64-linux-gnu/libglut*

Why's the asterisk? Is it a footnote or part of the code?

I don't seem to have /usr/ directory. I cannot find it anywhere.

How does Ubuntu directory work?

Thanks, - A.