I recently started using OmegaT, a free software to translate internal projects that I have with me.

One issue that I find while translating text files is that it does not take the line marks as a segment breaker. This can be changed by going into Options -> File Filters and under "Text Files", select options to choose the "Line Breaks" as the segment source.

Randomize the line numbers in a text file:
python -c "import random, sys; lines = open(sys.argv[1]).readlines(); random.shuffle(lines); print ''.join(lines)," D:\GPC\plfiles\Desktop\KPT\Corpus\OtherLangCorpus\Sindhi\combined\test.txt > D:\GPC\plfiles\Desktop\KPT\Corpus\OtherLangCorpus\Sindhi\combined\test_rand.txt


________
Count Unique lines in a large file (works on Ubuntu):
sort input.txt | uniq -c > output.txt

Sorts file with highest frequency lines at the top:
sort input.txt | uniq -c | sort -bgr > output.txt
_______________
Compare text Files:
Find line numbers in second file that are not present in the first file.
i.e. compare first and second file and give list of the words from second file that is not present in the first file.
Basically looks for all lines in second-file.txt which don't match any line in first-file.txt. Might be slow if the files are large.

I was once trying to run a grep command to a directory and looking for a string inside it.
While the directory I was looking into was in a different drive (F:) than that of the system drive (C:) where the grep was installed.

I used the command prompt to first descend into the directory. So, I first went into the directory such that my command prompt looked like as follows:
    F:\MySearchDirectory>

As I was already into this directory, I just shot the gremp command like the following:

    grep -r "mysearchstring"

But this came with an error as follows:

    grep: (standard input): Not enough space

Of course my computer did not have any issues with the space as this was an I7 processor with a huge 16GB of RAM and the hard disk had more than 40% available in all the drives.

This must have to be something else.

I tried to find out but the solutions given were rather too geeky like installing cygwin to do this.

However, I tried to do this using another method. I closed the command prompt and started it again. I did not change my directory in the commmand prompt to F: drive this time. Rather I just shot the following command at its default location:

    grep -r "mysearchstring" F:\MySearchDirectory

And lo, the result was out there in no time.

So, what did it do? I guess wingrep works best when it is in its default location and target anything at other location.

Hope this helps another Windows user.

I guess I am having a lot of free time or perhaps my being from JNU, currently the row throughout the world, I have been dabbling into a lot of debates in this regard, mostly on the social media (Facebook). However, I try to make it a point that I engage with only the people I know. The passions are too high, especially in the people associated with JNU. And there is chance that the debate might turn sour and debaters would step down to the level of getting personal or generalizing the person in front, as if the debater represents everyone who, supposedly, vouches for the idea he is speaking for.

I saw one post by one of my juniors. I do not know her that well, but yes you can say that I have met her and feel that a debating spirit would be there in her. As we were discussing our viewpoints, mine being the right and hers being the left.

So, it all began with a post by her on Facebook about an article on Scroll.com titled: "Soon, a government media cell will track and counter negative content". Her post goes as follows:

How to replace spaces from directories with an underscore in linux?

A Bash command like the following can do this. On your terminal, you need to be in the directory going down from where you want to change the directories. Please note that the following command does the replacements recursively. SO, even the sub-directories would have its spaces replaced with an underscore:

   find -depth -name "* *" -execdir rename 's/ /_/g' "{}" \;

If you do not want to do it recursively also into sub-directories, you should fire the following command:
   find -name "* *" -type d | rename 's/ /_/g'


How do to the same in the files?

Find the file names in a directory and its subdirectory containing spaces. Replace the space between the stars with any string and it will find the files containing that string.bio
    find -name "* *" -type f

To replace a string in the file name under that directory/sub-directory, use the following command:
    find -name "* *" -type f | rename 's/ /_/g'