Tag Info

Hot answers tagged

9

I think this should do it: tar -xzf file.tar.gz -C ~/locationX folder1 -C ~/locationY folder2 The -C option means to change to the specified directory before doing the extraction. Specifying filename arguments after the tarfile name restricts the extraction to just those files or directories. And you can repeat this -Changing directories as you do. Note ...


4

No, it's not correct. I have no idea what the \1{3} is supposed to be but that's what is causing you problems. If you want to find lines that contain three repeated characters followed by three other repeated characters, you can use this: grep -E '([a-z])\1{2}([a-z])\2{2}' The \1 refers to the first captured group. You can capture groups by using ...


3

If you want to use grep, you can do: grep -av '^.*$' file in UTF-8 locales to get the lines that have at least an invalid UTF-8 sequence (this works with GNU Grep at least).


3

I find uconv (in icu-devtools package in Debian) useful to inspect UTF-8 data: $ print '\\xE9 \xe9 \u20ac \ud800\udc00 \U110000' | uconv --callback escape-c -t us \xE9 \xE9 \u20ac \xED\xA0\x80\xED\xB0\x80 \xF4\x90\x80\x80 (The \xs help spotting the invalid characters (except for the false positive voluntarily introduced with a literal \xE9 above)). ...


2

String interpolation causes this. There are a number of ways to selectively prevent this from happening. The bash hackers wiki has some good examples, though the specifics may vary if you're not actually using bash. In short, you can prevent interpolation with single quotes, or you can escape the characters. [me:~/work]$ export foo=bar [me:~/work]$ echo ...


2

I like using an easy to use unix command line bash script called VCS - Video Contact Sheet. Their official page: http://p.outlyer.net/vcs/ Its a lot easier to use even easier than a GUI ''It is a bash script meant to create video contact sheets (previews) aka thumbnails or previews of videos. Any video supported by mplayer and ffmpeg can be used by this ...


1

Functions are perfectly suitable for this purpose. For example: cmd() { echo $* >> /path/to/file'; } This is on one line, just like an alias. But it can take parameters.


1

Python has had a built-in unicode function since version 2.0. #!/usr/bin/env python2 import sys for line in sys.stdin: try: unicode(line, 'utf-8') except UnicodeDecodeError: sys.stdout.write(line) In Python 3, unicode has been folded into str. It needs to be passed a bytes-like object, here the underlying buffer objects for the ...


1

Let's use AWK! This function lists the frequency of each word occurring in the provided file in Descending order: function wordfrequency() { awk ' BEGIN { FS="[^a-zA-Z]+" } { for (i=1; i<=NF; i++) { word = tolower($i) words[word]++ } } END { for (w in words) ...


1

In some case, wmctrl could help. This utility is compatible with a lot of windows managers. wmcrt -m should display the name of the currently used window manager.



Only top voted, non community-wiki answers of a minimum length are eligible