Software :: Remove Particular Characters Using Sed
Dec 13, 2010
file = TT.ParlayX_RequestLog_78653_20101212180044.log.17490
1. Want to remove the characters before the first dot (.) including the dot (.)
2. Want to remove the characters after the last dot (.) including the dot (.)
That is, basically, I want the output as:
ParlayX_RequestLog_78653_20101212180044.log
View 7 Replies
ADVERTISEMENT
Feb 20, 2011
I am doing a mysql query with a bash shell script like:
mysql translator -u root --password=******** -e "SELECT word FROM tagalog ORDER BY RAND() LIMIT 1" | while read line; do
echo $line
So when I echo the value of $line I get:
word
magandang umaga
"word" is the name of the row in the table and maganda umaga is a randomly selected choice from the row. Is there a way i can remove the name of the row from the variable $line. With a result that will allow me to echo $line and output only the randomly selected entry in from the row e.g. magandang umaga
View 13 Replies
View Related
Jun 3, 2010
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:
Code:
00000000000000000089;0bbfaeb8
01000000000000000089;0bcb5948
00000000000000000089;0bcc4c40
[code]....
View 5 Replies
View Related
Nov 7, 2010
I am using 'sed -e /foo/d' to match lines which I want to delete from a file. I discovered I have some lines which contain random (extended?) characters like 'ủ' which I would also like to delete. The lines in the file should only contain alpha numeric characters.
View 8 Replies
View Related
Apr 14, 2010
How can I remove characters from grep output using sed? code...
View 9 Replies
View Related
Jan 30, 2011
I am reading strings from a file using readline() function,the file contains some strings which has only special characters, I need to avoid the strings which has only special characters, the special characters are not similar. How to do it in python.??
View 2 Replies
View Related
Apr 27, 2010
I hope you can help. I have a collection of spreadsheets with data that needs to be imported in to SQL. The data has been manually entered although there are portions where data has been copied and pasted from the web.
When converting these sheets to a CSV I get strange characters where it looks as though data has been copied and pasted. Is it possible to write a script (AWK?) to pull out these characters?
I guess the script will need to keep alpha characters, spaces, numerics and commas but nothing else. How easy is this to do?
View 7 Replies
View Related
Sep 18, 2011
I have a directory (Linux user) with a number of files which contain an added [!] to the end of each file name so that each file reads out as:
foo something [!].zip
bar something [!].zip
helloworld [!].zip
etc.
What is the quickest way to batch rename these to remove the ending [!] character combination from these file names?
View 2 Replies
View Related
Jul 26, 2010
I am working with a Tcl script and have some strings in the following format (RE):
[a-zA-Z]+[0-9]{6}-[0-9]
There are some leading letters, combinations of capital and lowercase. Then six digits, followed by a hyphen, then one more digit. I would like to remove all of the leading alphabetic characters from the string. The resulting string would then be in this format: [0-9]{6}-[0-9]. In other words, six numeric digits, a hyphen, then one more digit.
I have tried:
Code:
set newstr [string trimleft $origstr alpha]
But that only removes the first alphabetic character, not all of them.
I couldn't get anything with regsub to work correctly, but I am somewhat of a noob with RE's in general and regsub in particular. There are usually 5 leading letters at the beginning of these strings, and I could in most cases get away with using string replace and constant indices to extract the substring. However, my preference is for this to be robust enough to handle all cases with 1 through n leading alphabetic characters.
View 3 Replies
View Related
Jul 8, 2011
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?
View 4 Replies
View Related
Aug 28, 2011
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?
View 1 Replies
View Related
Jun 16, 2010
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.
View 6 Replies
View Related
Jul 15, 2010
This has been bothering me for years now...when I go to remove a thumb drive from my computer, I have two options when I right click the device eject and safely remove. What on earth is the difference supposed to be?
View 3 Replies
View Related
Jun 28, 2011
To remove pendrive when I click the 'safely remove' tab instead of getting removed from the desktop it reappears again. This problem is there in fedora 14
View 4 Replies
View Related
Dec 15, 2010
Anyone else seeing this? I do 'safely remove' to remove USB flash drive. disappears. Five seconds (or less) later, it reappears. The second time I do 'safely remove', it stays gone.
View 1 Replies
View Related
Jun 21, 2010
I am the only user on my laptop so there are somethings that I don't need.I would like to remove the login at start. What do I remove to make it go away? Second one is Keyring. Is it necessary? Can I remove it without causing problems?
View 8 Replies
View Related
Dec 29, 2010
I often use VNC to connect to my desktop upstairs using a laptop downstairs over my home network. I tunnel the VNC connection via SSH. The problem I keep running into is that I'll attempt to type a ! or a : or even a captial A and it will come across the wire as a 1, ;, or a respectively. Is this something I can fix? It's really REALLY annoying while one is programming to have to pop open character map and find a colon and copy/paste it in each time. Running Ubuntu 10.04 upstairs, Linux Mint 10 downstairs.
View 1 Replies
View Related
Jul 6, 2010
I added a Romanian keyboard to the system. When I check the layout I see some keys have four characters associated with them. For example the key highlighted in the screenshot I attached has four characters: ș, Ș, ;, :. The first two can be used by pressing the key with or without Shift, but how about the other two?
View 1 Replies
View Related
Dec 23, 2010
Just now, after I open my computer, all of sudden, all the characters in windows and menus became little rectangles. What shall I do?
View 9 Replies
View Related
Aug 17, 2010
any tips from you guys on how to filter my awk output?I want to exclude last 5 characters using awk in my tcpdump result.I don't want to include ".443:" in my tcpdump using awk.
View 6 Replies
View Related
Nov 1, 2010
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/.* [*]
View 7 Replies
View Related
Nov 4, 2010
How many characters does Linux recognize on usernames?
View 2 Replies
View Related
Apr 4, 2010
The input file consists of several fields. The first field is always five or more characters long. I want to keep the last five characters of the first field.
Example:
If the input file record is FEDERAL PACIFIC ELECTRIC PRODUCTS then I want to keep DERAL I can do this in four steps by using C, REV, C, and REV again but that seems like doing an easy thing the hard way. Is there a straightforward way to achieve this result with C or some other command?
View 14 Replies
View Related
Nov 2, 2010
I have a file with a random word on each line (3k+ lines). How can I get the lines with only five characters? I tried using grep file | more, but it returns all the words (even those less than 5 characters).
Edit: I also tried grep '.{5}' file | more but it doesn't show anything. And grep '.{5}' file | more returns all lines with four or more characters (I'm really confused about why it's doing this).
View 4 Replies
View Related
Sep 3, 2010
Say I had a string like so
Let's say I only wanted to grab TAC and BDX the ones in the 2nd, 4th, and 6th spot.
Will grab the lines from the rest of the file assuming these are the only lines with capital letters at the very beginning of each line.
Will delete the first 'T'. What I want to do is learn how to just pick the even characters, T(T)A(A)C(C) & B(B)D(D)X(X).
Is there something like the {1} which can pick just the even or odd character matches?
View 3 Replies
View Related
Feb 16, 2009
I'm working on my ncurses application, written in C. I get user input through a loop which uses getchar(). I was able to recognize Ctrl-n by comparing the keypress to ASCII character 16, and this seems to work fine. However, if I noticed that the ASCII character for Ctrl-j (10) is the same as the Line Feed. I tested this, and if I press enter on the keyboard I get the same ASCII value as when I press Ctrl-j.
So, what do I do if I want Ctrl-j to mean something different in my program than pressing enter?The ncurses terminal mode is set to raw, with a 100 millisecond timeout, and keypad is on (I'm already using the up and down arrow-keys).
View 1 Replies
View Related
Feb 18, 2010
I am trying to create an array containing all ASCII characters, how do I create one:
Code:
#!/bin/bash
CHARLIST=( a b c d e f g h i j k l m n o p q r s t u v w x y z
[code]...
View 6 Replies
View Related
May 12, 2010
I see I'm finally posting an AWK question rather than an answer for a change I wanted to make an AWK script that would scramble all the characters in each field, but leave the first and last characters where they were.
View 14 Replies
View Related
Mar 17, 2010
In a file i have to grep for a particular word and cut 8 characters of that word and replace the last characters with space if it is _1.Eg: HP4350_1..i did grep|cut -c 2-9|but didn't know how to truncate the last two characters if its '_1'.i used tr '[_1] '[ ]'.but it replaced all the characters where there is a 'underscore' and 1 instead of'_1' together.
View 5 Replies
View Related
Jul 11, 2010
Is there any way to limit user name to characters so when I create an account and if the account name is more than 8 characters long, it will not allow.
View 1 Replies
View Related