Hello all.
I have 100 sub-directories that "rar" files exist in them, How can I move all rar files into parent directory?
I used "find sourcedir -type f -exec mv {} targetdir \; " but i just copy one file and all files deleted
Thank you.
Hello, I have an embedded linux device. I can connect to the device and I can upload or download files. No problem with this. But, at first connection, I want to connect to "/" directory instead of "/root". In the device file system, there are files ssh_config and sshd_config under /etc/ssh directory. I think I have to do something with these files but I don't know what.
I don't exactly know what mean "/root" and "/" directories. I think that the real root directory is "/" directory which is empty but when I connect with filezilla, the "/root" directory is the default so I had to go back to / directory everytime.
Hey everyone,
I am trying to find a way to untar a file.tar.gz in my home/noob directory into 15 different directories.
where the tar.gz file is located: /home/noob
where the 15 directories are located: /home/noob/Staging/ 1-15 folders
Without having to extract the tarball individually, is there a simple way in one or two commands that can take the tarball and extract it to all 15 folders ?
Please and thanks!
I have a little bash script that cats out a file and tells me if there is a line
where the 11th column has more than 6 characters in it.
It emails me where there is a bad line in a file - bead meaning that it will break a
donwstream process.
anyhow when i get the email saying that there is a bad file i just log in to the pc via
vpn and the I sed out the lines from the file that I get in the email. The bad lines are
always in danny.csv not danny1.csv
It has been the same lines killing the downstream process for a few weeks, so i put the "sed -i's" into
the script and it does it automagically.
[CODE]
for i in danny.csv danny1.csv
do
cat /come/and/play/with/$i | perl -ne 'print if length((split /,/)[10]) > 6' | mail -s "danny.csv bad line" casper@casperr.com
done
#it would be nice to find a perl change the file in place
sed -i '/D,642,0642,UBF,EVL,,M,,S,S,FOREVER,213,213,/d' /come/and/play/with/us/danny.csv
sed -i '/D,642,0642,UBF,EVL,,M,,S,S,QSP-U=C,4,4,/d' /come/and/play/with/us/danny.csv
[CODE]
However when a new line gets put into this file, I am going to have to log in and take out the line.
SO I have been trying to write a perl one liner that will edit the file in place, like sed, and make a
backup of the file. I just need a perl one liner that will delete any line where the 11th columns has more
than 6 characters in it.
[CODE]
perl -p -i.bak -e 's/\,\w{7}\,//g - which does not work.
[CODE]
I tried something like this:
[CODE]
perl -nle 'print if /\,\w{7}\,/' /come/and/play/with/us/danny.csv
[CODE]
but that does not catch the QSP-U=C and it catches more lines than just the
FOREVER. for a solutinog I need to focus on the the 11th column.
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.
I have a directory w/ a file that I created using:
Code:
fd = open("file", O_CREAT);
The file turned out to be executable. When I did a 'ls -l' on the directory w'/ that file it has a "T" at the end of the permissions where the executable bit would be set for the "other" group.
Ok yes this is a homework assignment BUT I am NOT looking to have the answers given to me. I am in the 6th week of my first Linux class ever and we are in our few weeks of beginning scripting. I have some ideas of what to do or where to start but not many and no one to bounce any ideas off...we are using UNIX Bash shell so any others I have no clue. The scenario is that I need a script that searches all my users home directories for bad words. I need the script to report to the screen certain info like username and word found and path. It should ask a user if it is good or bad and if bad be put into a file of list of bad file names, if good remove from list and no longer flagged by the script. What I have so far is wanting to somehow do a loop. I do know that if I do a grep -r -e kill -e steal /home/* I get a list of what I need. I also know that the list is separated by delimiters which I can pipe to get a variable for the things I need. I also know that I can put it to a file with a > filename.txt
What I have no clue is how to start a loop that would do this...
for each line in filename.txt
UNAME=...
LOC=...
TXT=...
echo "Username: $UNAME, Line with bad word found: $TXT, and Path and file name: $LOC. Is this a BAD file? (Y)"
Read YORN
if ["$YORN" = "Y" ]; then
>> (line of text from grep) badfiles.txt
fi
Next or whatever goes there...sorry if this is crazy I just really need some direction. I am trying to learn so please don't give me the answer...that will do nothing for me and I will not be able to explain the code I came up with.
Hello all,
I am trying to figure out how to get bash to view for any contents in the "the_difference_between_today_and_yesterday.txt" file and then act if there is anything in the file. I thought i had it, but it is not working like I thought. Any ideas?
Code:
if [ -f final_version_$dater.txt ];
then
if [ -f final_version_$yester_dater.txt ];
then
diff final_version_$dater.txt final_version_$yester_dater.txt | grep "^>" | sed 's/>\ //g' > the_difference_between_today_and_yesterday.txt
if grep ^[a-z]* "the_difference_between_today_and_yesterday.txt";
then
cp the_difference_between_today_and_yesterday.txt /tmp/24hourlemons_table; mysqlimport --user=USERNAME --password=PASSWORD --columns=name,start_date,end_date,link_url,location \
--fields-terminated-by=':' --lines-terminated-by='\n' carshows /tmp/24hourlemons_table; rm final_version_$three_days_later.txt
else
echo "There were no differences between the two files"; rm final_version_$three_days_later.txt
fi
else
echo "ERROR! The file of: final_version_$yester_dater.txt does not exist" >> error.log
fi
fi
Hello,
I am troubleshooting something and I got this problem.
If I do "pstree -p"
It shows,
Code:
├─soffice.bin(7734)─┬─{soffice.bin}(7735)
│ ├─{soffice.bin}(7736)
│ ├─{soffice.bin}(7737)
│ └─{soffice.bin}(7743)
However, it does NOT show up in "ps -elf"
Code:
ps -elf | grep soffi
0 S whho 7734 1 0 80 0 - 36435 - 11:14 pts/2 00:00:03 /usr/lib/openoffice/program/soffice.bin -splash-pipe=5
0 S whho 7833 7759 0 80 0 - 751 - 11:21 pts/3 00:00:00 grep soffi
I was wondering if 7735, 7736, 7737, 7743 were really processes. Then I checked /proc, I could cd to /proc/7735, /proc/7736, etc, but I could not ls them out.
I looked at the man page of "pstree", it says,
Code:
Child threads of a process are found under the parent process and are shown with the process name in curly braces, e.g.
icecast2---13*[{icecast2}]
So, what does all this mean? Does it mean that 7735, 7736, 7737, 7743 are just threads but not processes? If so, why could I cd to /proc/<id> but not see them in "ps -elf".
Would somebody please help me?
Thanks!
whho
Hi Linux Experts,
I have the following problem to solve:
-Below is the CSV file give
firstname,lastname,password,username,notes,city,phonenumber
fred,smith, notgood1, fredsmith, this user\, is the first in this file, Brighton,345698
Peter, Bloggs, anotherbad,peterbloggs,,London,987123
Jo, cooper, notmuch, jcooper, this user is Jo, Brighton, 456987
john, carter,nearlyempty,jcarter,This note is actually very long\, but really doesn't say anything very useful,,345777
sam,jones,passing, samjones, Not much of a note really, Manchester, 135790
- capitalise the first letter of the two name fields
- sanitise the formatting
- move the username column to the beginning of each line
- the phone number is missing the area code - look up the city in the following table, and add it to the beginning of the phone number column:
City, Area Code
London, 5
Brighton, 6
Manchester, 7
Provide the corrected CSV file.
One of the problems I have is that whenever I use the comma as FS the output for column 5 is the following
cat Test.csv | awk 'BEGIN { FS = "," } {print $5 }'
notes
this user\
this user is Jo
This note is actually very long\
Not much of a note really
It stops in the middle of the entry because it sees the comma but what I am trying to achieve is to produce the full entry for column 5 like this:
this user\, is the first in this file
This note is actually very long\, but really doesn't say anything very useful
I have to probably escape somehow the FS in the text but so far no joy with completing this task. Also can you kindly help out for the rest of the requirements.
I really appreciate your help in advance.
Ivan