The code below prints garbage if I use puts() but it is fine if I use printf() instead (see sample of output at the bottom of this post). The odd thing is that the mess always starts after exactly eight properly printed characters. That sort of regularity can't be a coincidence, can it? It almost looks like an encoding issue (I'm using UTF-8) but if it really is, then I don't understand why the printf() is unaffected.
Code: #include <stdio.h> #include <string.h> const char *nChars (const char *, int); int main (int argc, char * argv[]){ char * name ="Count Dracula++"; int len = strlen(name); if (argv[1] == 0) argv[1]="printf"; printf("--->%d characters", len); .....
What I am doing is reading the text from a text document and storing all of the text inside of a ArrayList. I then set one of the values of the Arraylist as a string. I want to use regular expressions find out what the first two characters of the String are. if first two characters = "//" then function(); I only care about the first two characters though. If you need any more information, just ask.
How can I filter ASCII quotes( ' ) and double quotes ( " ) so that I can replace them with the UTF-8 equivalent?If I copy text from a Word Document(ASCII), and upload it to a web page with PHP. The Database(UTF-8) will replace these racters with incorrect character(s).I need some function that will replace these characters but I don't know how to differentiate the ASCII quotes and the UTF-8 Quotes without (somehow) converting the string to hex, then preg_replace'ing the hex code for the symbol.
Lets say I have 20 files named FOOXX, where XX is the number of the file, eg 01, 02 etc. At the moment, if I want to delete all files lower than the number 10, this is easy and I just use a wildcard, eg rm FOO0* However, if I want to delete specific files ina range, eg 13-15, this becomes more difficult. rm FPP[13-15] does not work, and asks me if I wish to delete all files. Likewse rm FOO1[3-5] wishes to delete all files that begin with FOO1 So, what is the best way to delete ranges of files like this? I have tried with both bash and zsh, and I don't think they differ so much for such a basic task?
I'm trying to understand rsync filters .. but it isn't goig to well.I want to rsync only files with a specific extension (.gz.des3). Could someone please tell me how to add such filter to the rsync commandline (not a seperate filter filer).
I have a 50000 line(ish) set of records in a file. I have another file where I have filtered out all the line numbers for those which have an error of various types. e.g column count, field type etc. I want to get all those lines into a separate file so I can sanitise them. There are abt 3-4000 of them.
How can I access those lines which I want to isolate into a single file? I have all the usual linux stuff available and a bit of understanding of regexps.
We have a list of cyclones in the world. Now i got to check whether or not the second field is more than 1000 mm. If so, than the line has to have a[*] at the end of the line. For exemple:
Australia:1411:55.55:Mackay Cyclone 1918:1918:Mackay to Australia:1411:55.55:Mackay Cyclone 1918:1918:Mackay[*]
I also have to use a substitute. So far i've got this but it fails, 6,$s/([0-9])111:1/.* [*]
Any time the word The appears at the beginning of a line, I want to move it to the end of the line and capitalize the new first word in the line. For example, The heaven becomes Heaven the. I'm trying to test this out for my Library.
I'm having a bit of a headbanger trying to work this one out. I'm trying to remove all of the characters on a line apart from the last 17. For example, I need to change this:
I would like to replace 'xxxx' with 'yyyy' which is in a file xyz.csproj not sure of what 'xxxx' is, it can be 3055, 4056, 7089 etc. I know it always appears at line # 5 and at character 50.
I have a bunch of files (around 900) that have some special characters. Some of the files contains example, and quoting "[useless] filename (something)"so what I want is just to strip the brackets and parenthesis, some are folders, others are text files
I'm having trouble setting up PuTTY with Ubuntu. I'm trying to get line characters to work in aptitude as well as 256-color support, but can only get one or the other.
Ubuntu Config:
Using 64-bit Ubuntu Terminal type xterm-256color or putty-256color gives 256-color, but incorrect line characters. Terminal type linux gives proper lines in aptitude, but only 16 colors.
PuTTY Config:
Using font with Unicode characters. (DejaVu Sans Mono) Received Data is assumed to be in UTF-8. Set to use Unicode line drawing code points.
I've written myself a linux program "program" that does something with a regular expression. I want to call the program in the bash shell and pass that regular expression as a command line argument to the program(there are also other command line arguments). A typical regular expression looks like "[abc]_[x|y]".Unfortunately the characters [, ], and | are special characters in bash. Thus, calling "program [abc]_[x|y] anotheragument" doesn't work. Is there a way to pass the expression by using some sort of escape characters or quotation marks etc.?
(Calling program "[abc]_[x|y] anotheragument" isn't working either, because it interprets the two arguments as one.)
I've written myself a linux program "program" that does something with a regular expression. I want to call the program in the bash shell and pass that regular expression as a command line argument to the program (there are also other command line arguments). A typical regular expression looks like "[abc]_[x|y]". Unfortunately the characters [, ], and | are special characters in bash. Thus, calling "program [abc]_[x|y] anotheragument" doesn't work. Is there a way to pass the expression by using some sort of escape characters or quotation marks etc.? (Calling program "[abc]_[x|y] anotheragument" isn't working either, because it interprets the two arguments as one.)
I have a log file that contains information like this:
---------------------------- r11141 | prasath-palani | 2010-12-23 16:21:24 +0530 (Thu, 23 Dec 2010) | 1 line Changed paths: M /projects/ M /projects/
[code]....
what i need is, i need to copy the data given between the "---" to seperate files, for, e.g. the first set of data between the "---" should be in one file and another set of data in another file.
On my terminal only system ( no Xorg or guis ) I have a font rendering issue. In place of some symbols ( eg double-lines and some other miscellaneous line-drawing shapes) are generic diamonds. Attached is a fbgrab ( png format ) of elinks showing the problem. I have now configured elinks to only use single lines drawing characters ( which work fine ) for now as a work around. Here is my /etc/default/console-setup
Code:
# Change to "yes" and setupcon will explain what is being doing VERBOSE_OUTPUT="no" # Setup these consoles. Most people do not need to change this. ACTIVE_CONSOLES="/dev/tty[1-6]"
[code]....
The numbers in the FONTFACE show the size of the font matrix. For example Lat2-Terminus20x10.psf is a font for codeset Lat2 with size of the font matrix 10x20 (i.e. 10 columns and 20 rows). If the number of columns is 8 then only the number of rows is specified. For example the font matrix of Armenian-Fixed15.psf has size 8x15.
In text video mode or if you use the RadeonFB kernel module only fonts whose font matrix has 8 columns can be used (that is the size should be a simple NUMBER rather than a NUMBERxNUMBER combination). The other fonts can be used only with framebuffer video modes and with the package 'kbd'. The console package 'console-tools' can not be used with such fonts.
THE TERMINUS FONT:
The aim of the Terminus font is to reduce the eyes-fatigue when one has to read a lot. Currently this font supports only the Latin, the Cyrillic and the Greek scripts (the Lat15, Lat2, Lat7, CyrAsia, CyrKoi, CyrSlav, Greek, Uni2 and Uni3 codesets). The fonts with font face TerminusBold and size 14 or 16 are optimized for 8 pixels width glyph matrix (in most cases this means framebuffer). The fonts with font face TerminusBoldVGA and size 14 or 16 are optimized for 9 pixels width glyph matrix and can not be used with framebuffer video modes.
The fonts with font face Terminus and size 14 or 16 can be used both with 8 and 9 pixels width glyph matrix. In the regular text video modes the width of the glyph matrix is 9 pixels. If you use the package svgatextmode then the width is 8 or 9 pixels and you probably know it. The Terminus font in this version of console-setup is version 4.26.
I upgraded in Ubuntu from 2.6.28-13 to 2.6.30 and now I get no line-drawing characters in applications like alsamixer; instead they are replaced by 127-bit chars like 'lqqk'. As a coder, I'd really like to understand what happened - what changed (file in /etc?) affecting terminal capabilities, and what does the kernel have to do with it .
PS: the distro is Jaunty and I used the debs at http://kernel.ubuntu.com/~kernel-mainline/:
What command could I use in terminal to delete all ASCII characters? That is, delete a-z, A-Z, 0-9, and all punctuation? I have a file containing Chinese characters, and I want to remove everything else and leave just the Chinese.
I can use grep to leave only the lines that have Chinese in them, but this still leaves a lot of non-Chinese stuff on those lines. Does anyone know how I could actually remove everything that isn't Chinese?
While modifying the definition of my PS1, I saw that "[" and "]" markers should be added to help bash to compute the right display lenght. Many exemples on the web do not use them or even mention them.I searched for a solution to add them automatically, like with sed, but I didn't find any example.Are they still needed and is there a recommandation not to use sed to define PS1?
I have my OpenSuse 11.1 box set up with utf-8, however, every time I try to open a file with utf-8 characters with vi it can't handle those characters properly.
I was able to set up my printer using a guide i found on this site. However when i print a page from my e-mail account, for example. It will either print the whole page with advertisements and all when i select print from the file menu up top or it will only print what is showing on the screen and cut off the rest of the words in the e-mail that are not showing on the screen, when i select print icon within the e-mail.
I have a pre-printed form that I need to fill in. Is it possible to scan it, fill it in on screen, and then put the original form in the printer and get things to print out on that original form? I know that I can scan the form and fill it in on screen and print out on a blank piece of paper, but I need to use the original form