Say I have a large plaintext file with a string on every line. The string only consists of alphabetical characters, except for underscores _, which divide the strings in syllables.
I want to sort the text file by the amount underscores in the string. Bonus points for putting every group of X underscores in their own file.
Example:
hel_lo
hi
su_per_u_ser
o_ver_flow
would sort into:
hi
hel_lo
o_ver_flow
su_per_u_ser
I've tried doing this with regex, but I've yet to find a proper way of counting the underscores (regex confuses me thoroughly).
Anyone know how I could handle this?
I'm running CentOS 6.x and want to move the .bash_history to a different location.
The home directories of my users are (because I run a VPS) in /var/www/vhost/<domain>.<tld> which is FTP accessible (and it should be).
Because of this, I have changed the AuthorizedKeysFile for SSH connections out of the normal ~/.ssh/authorized_keys since FTP connections would easily be able to locate them.
At the same time I want to move the .bash_history file to /home/%u/.bash_history where %u is the current user.
I have two volumes, one xfs, and another ntfs - ntfs was empty, and xfs had 10 subitems.
I needed to sync them.
I initially copied a few of the subitems by dragging them over in a gui fm. Several of the direct descendants which i had dragged finished, apparently. One I stopped before it was done, and the rest I cancelled while it still appeared to be gathering information about the files.
Then I ran rsync -acvvv xmp/ nmp/, where xmp and nmp are the volumes' respective mountpoints, which exited with a 0 status.
find xmp -printf x | wc -c and find nmp -printf x | wc -c both return 372926.
My question is: Am I guaranteed that the two drives' contents are identical?
I am using Mac OS X Snow Leopard and when I type
ls c *
this is what I get in my terminal:
clock:
PSD demo.html jquery.tzineClock script.js styles.css
clock2:
clojure-presentations:
Clojure-1up.pdf ClojureInTheField-1up.pdf license.html
Clojure-4up.pdf README
ClojureForRubyists-1up.pdf keynote
coffee-script:
Cakefile README bin examples index.html package.json test
LICENSE Rakefile documentation extras lib src vendor
By default I am using Bash.
I am getting an error message to the effect of unable to move files to a single file. I am not trying to do this. What I am trying to do is move files from one folder to another folder (staging) and then deleting the original folder.
If you can show me a better way to do this since I am not doing this correctly.
Thank you.
Here is my .cmd file:
Y:
move "Y:\ABC_files\*.js" "C:\Documents and Settings\user\Desktop\ABC_Stage\ABC_files\"
move "Y:\ABC_files\*.css" "C:\Documents and Settings\user\Desktop\ABC_Stage\ABC_files\"
move "Y:\ABC_files\*.png" "C:\Documents and Settings\user\Desktop\ABC_Stage\ABC_files\"
move "Y:\ABC_files\*.htm" "C:\Documents and Settings\user\Desktop\ABC_Stage\ABC_files\"
move "Y:\ABC_files\*.gif" "C:\Documents and Settings\user\Desktop\ABC_Stage\ABC_files\"
move "Y:\ABC.htm "C:\Documents and Settings\user\Desktop\ABC_Stage\"
rmdir "Y:\ABC_files"
C:\"Program Files"\"App X"\App-IDE.exe -r ABC4.run
As the title says.I would like a script that tells windows that the next boot should be into safe mode or atleast that the "F8" menu should be presented next boot.Booting into WinRE(Launch startup repair...) is problably even more un-doable.I looked over bcdedit options but did'nt see anything like this.I know msconfig has an option for safe boot but it's gui only.
Currently if i wan't to boot into safe mode or launch WinRE then i have to forcefully restart my pc first for those options to be presented during boot(F8 does not bring up the safe mode option under normal conditions).
Im using Windows 7 x64.
I have two .rtf file....
The first one have this content:
Apple, Orange, Banana, Noodle, Chip
The Second File is something like this:
Apple I love eat Apple.
Banana I hate Banana.
Zoo I want to go Zoo.
Noodle Noodle can be a very very very very very very very very very very very long, but still is one line.
Chip Don't eat so many chip.
Orange Orange is great, not Apple plx. Noodle
Water Drinking water is boring.
The first file is a "key" of second file. In the second file, the first word is the key of each line. Each key and sentence in second file ONLY have one line. The Second File have many lines with key, but not all the key is shown on file1, but file1's key MUST in the second file.
How can I get the result like this: (Need to sort by the key from File1)
Apple, Apple I love eat Apple.
Orange, Orange is great, not Apple plx.
Banana, I hate Banana.
Noodle, can be a very very very very very very very very very very very long, but still is one sentence.
Chip, Don't eat so many chip.
I have seen how simple it is for Mac OS to generate pdf from a document without additional software to install.
But I am looking for this functionality in Linux.
One scenario, for example, if I have myDocument.txt that contain an article, how can I convert this into pdf? My next question is, assuming that myDocument.txt is a 3-paged document, will it generate a 3-page continuous pdf and not just 3 separate pdfs?
Any tools for linux that does this? (GUI is fine, but commandline is preferable)
is there anyway to convince mput to send all sub directories of the current directory to the server. Im trying to write a script to automatically update a website when it is run. So far ive been trying
mput *
but that only sends the files in the current directory.
Any help would be appreciated.
From the diff manpage:
-b, --ignore-space-change
ignore changes in the amount of white space
-w, --ignore-all-space
ignore all white space
From this, I infer that the difference between the -b and -w options must be that -b is sensitive to the type of whitespace (tabs vs. spaces). However, that does not seem to be the case:
$ diff 1.txt 2.txt
1,3c1,3
< Four spaces, changed to one tab
< Eight Spaces, changed to two tabs
< Four spaces, changed to two spaces
---
> Four spaces, changed to one tab
> Eight Spaces, changed to two tabs
> Four spaces, changed to two spaces
$ diff -b 1.txt 2.txt
$ diff -w 1.txt 2.txt
$
So, what is the difference between the -b and -w options? Tested with diffutils 3.2 on Kubuntu Linux 13.04.
I'm looking for some software for my OpenSUSE, which with I would be able to organize my audio files.
I've found one, which may be good, but it's unable to run without X server (in CLI).
http://musicbrainz.org/doc/MusicBrainz_Picard
I'm not looking for ID3 renamers. There're maybe hundreds of them... I'm looking for software, which has its own database, or is able to communicate with some database, like CDDB, Gracenote, last.fm etc.
So apparently, CentOS decided I was Dutch, and thus, should not have a English locale.
Apart from the fact that this greatly bothers me, I am having a pretty hard time actually changing it back. There does not seem to be a setlocale function, and system-config-language tells me I am using an English locale, even though my environment says otherwise.
Any help would be appreciated.
Output from locale:
LANG=nl_NL.UTF-8
LC_CTYPE="nl_NL.UTF-8"
LC_NUMERIC="nl_NL.UTF-8"
LC_TIME="nl_NL.UTF-8"
LC_COLLATE="nl_NL.UTF-8"
LC_MONETARY="nl_NL.UTF-8"
LC_MESSAGES="nl_NL.UTF-8"
LC_PAPER="nl_NL.UTF-8"
LC_NAME="nl_NL.UTF-8"
LC_ADDRESS="nl_NL.UTF-8"
LC_TELEPHONE="nl_NL.UTF-8"
LC_MEASUREMENT="nl_NL.UTF-8"
LC_IDENTIFICATION="nl_NL.UTF-8"
LC_ALL=
Both my ~/.bashrc as ~/.bash_profile contain no locale settings. Additionally, /etc/bashrc does not contain any locale references either.
There must be a way to control the built-in VPN client in OS-X Snow Leopard, I simply can't find documentation about it. I want to be able to connect and disconnect while I'm ssh'd into my box remotely. Does anyone know how to do that?
For example:
I'm in the directory:
F:\Data
Inside this directory, I have four directories:
F:\Datadir
22179 22915 23459 23460
These directories have various content, including directories and files.
I'm trying to run something like:
rmdir /s *\*
where I delete all the contents of these numbered directories, while leaving the empty directories. Is there a one-liner that can do this, or do I have to loop through the sub-directories?
I am working on an auto-install script for where I work and we have a ClickOnce type application we use from a vendor. I have looked into it and we can't automate the install but we would like to be able to at least start the install automatically.
I have tried
rundll32.exe dfshim.dll,ShOpenVerbApplication "%SOFTWARE%\ToolsApp.application"
but it gives me an error about an invalid URI.
What would probably be the easiest is to use whatever program Windows has (Windows XP in our case) to run the default "handler" for the file. I don't know if any such thing exists, but that is what comes to mind.
I'm trying to setup rsync to backup a remote directory to my local drive.
I cd to the directory that I want to pull the files to, then I enter:
rsync -vrtW [email protected]:~/public_html
I enter the password then it starts running. I get all the files listed, but none of them actually transfer. What am I missing?
Thanks
Given this example folder structure:
/folder1/file1.txt
/folder1/file2.djd
/folder2/file3.txt
/folder2/file2.fha
How do I do a recursive text search on all *.txt files with grep from "/"?
("grep -r <pattern> *.txt" fails when run from "/", since there are no .txt files in that folder.)
I have a dev copy of a website set up that has quite a few hardcoded references to its live counterpart.
I would like to replace all occurrences of "www." with "dev." in all files.
I think I can use a combination of grep + sed, but I'm not sure how.
I have a folder named "C:\Jobs\job#1" , "C:\Jobs\job#2" "C:\Jobs\job#3" etc and a lot of directories and sub-directories under it.
I want to get the all the directories under Jobs and xcopy them to C:\backup.
Then I want to xcopy all the files under each Job#1, 2 ,3 etc. to C:\backup\job#1\month\\*.*
To make it clearer.
Source dir = C:\Jobs\job#1\"myfiles&dir"
Destination dir = C:\Backup\job#1\month\"myfiles&dir"
then do the next folder
Source dir = C:\Jobs\job#2\"myfiles&dir"
Destination dir = C:\Backup\job#2\month\"myfiles&dir"
...until all folders are back-up. Since the job folder keep increasing, by doing it this way I don't have to add extra code on this script except modify the month. Thank you.
Hello, I have a folderA that contains folderB that contains alot of files. I would like to get rid of folderB, but not its contents. I want those contents to be inside of folderA. How can I accomplish this on the commandline?
Is this possible with rsync?
Transfer everything from src:path/to/dir to dest:/path/to/other/dir and delete some of the source files in src:path/to/dir that match a pattern (or size limit) but keep all other files. I couldn't find a way to limit --remove-source-files with a regexp or size limit.
Update1 (clarification): I'd like all files in src:path/to/dir to be copied to dest:/path/to/other/dir. Once this is done, I'd like to have some files (those that match a regexp or size limit) in src:path/to/dir deleted but don't want to have anything deleted in dest:/path/to/other/dir.
Update2 (more clarification): Unfortunately, I can't simply rsync everything and then manually delete the files matching my regexp from src:. The files to be deleted are continuously created.
So let's say there are N files of the type I'd like to delete after the transfer in src: when rsync starts. By the time rsync finishes there will be N+M such files there. If I now delete them manually, I'll lose the M files that were created while rsync was running.
Hence I'd like to have a solution that guarantees that the only files deleted from src: are those known to be successfully copied over to dest:. I could fetch a file list from dest: after the rsync is complete, and compare that list of files with what I have in src:, and then do the removal manually. But I was wondering if rsync can do this by itself.
I have a Ubuntu Server VPS and I want to use /bin/bash/ as my shell. How can I change my shell? I have root access but I don't work as root. So dash is my default shell now.
I have read How do I make Bash my default shell on Ubuntu? and chsh seams to be the preferred way to go. But when I type chsh /bin/bash I get this message:
chsh: unknown user /bin/bash
And if I just type /bin/bash the Bash shell seams to work fine. How to change it?