Parsing textfile problem with cut


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Parsing textfile problem with cut
# 1  
Old 09-24-2008
Parsing textfile problem with cut

Hi,

I have a textfile with several lines like this:
PHP Code:
text numUSER text (numnum num 
I need all these stuff. Problem is, how to get these stuff after ":".
USER is a username and all chars are possible, even whitespace. So I cant use cut. Any ideas?
# 2  
Old 09-24-2008
One way with sed:

Code:
sed 's/.*: //' file

Regards
# 3  
Old 09-24-2008
You can use cut command as you had a doubt about cut.

Code:
cut -f'2' -d':' filename

# 4  
Old 09-24-2008
Question Unclear what you are trying to extract

Cut can handle a specified delimiter like space -d" " or colon with -d":"
Can you provide a better example of input data, and what you are trying to extract?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing a log file to cut off some parts

Dear all, I would like to use SQL's log file to extract information from it. This file can include four different types of instruction with the number of lines involved for each of them: -> (1) "INSERT" instruction with the number of lines inserted -> (2) "UPDATE" instruction with the... (4 Replies)
Discussion started by: dae
4 Replies

2. Shell Programming and Scripting

How to separate sorte different characters from one textfile and copy them in a new textfile?

My first post, so don't kill me :) Say i open some textfile with some example like this. on the table are handy, bread and wine Now i know exactly what is in and i want to separate and sorted it in terminal to an existing file with another 2 existing lines in like this: table plane ... (3 Replies)
Discussion started by: schwatter
3 Replies

3. Shell Programming and Scripting

Cut lines from and to in a textfile

i am having a text file like below rama surya pandu latha singh raja i want to get the new file from 3 to 5 i.e pandu latha singh please help (1 Reply)
Discussion started by: suryanarayana
1 Replies

4. Shell Programming and Scripting

Parsing problem

Hello, I have a similar problem so I continue this thread. I have: my_script_to_format_nicely_bdf.sh | grep "RawData" |tr -s ' '|cut -d' ' -f 4|tr -d '%' So it supposed to return the percentage used of RawData FS: 80 (Want to use it in a alert script) However I also have a RawData2 FS so... (17 Replies)
Discussion started by: drbiloukos
17 Replies

5. Shell Programming and Scripting

Parsing Problem

Hi all, I am having problems parsing the following file: cat mylist one,two,three four five,six My goal is to get each number on a seperate line. one two three four five six I tried this command: sed -e 's/\,/^M/g' mylist (11 Replies)
Discussion started by: rob11g
11 Replies

6. Shell Programming and Scripting

cut a string in a textfile line per line

i need to cut the string in a textfile but each line has a specific way of cutting it (different lengths) i have a for loop that gets the string line per line, then each line has to be compared: for x in `cat tmp2.txt`; do if; then echo 'BAC' elif ... (6 Replies)
Discussion started by: izuma
6 Replies

7. Shell Programming and Scripting

Parsing problem

I need to parse a string which looks like "xyx","sdfsdf","asf_asdf" into var1="xyx" var2="sdfsdf" var3="asf_asdf" (3 Replies)
Discussion started by: Sushir03
3 Replies

8. Shell Programming and Scripting

Parsing problem

Hi, i need to parse a string which looks like this "xyz","1233","cm_asdfasdf" (2 Replies)
Discussion started by: Sushir03
2 Replies

9. Shell Programming and Scripting

Parsing problem

I need to separate out the contents in the string "xyz","1233","cm_asdfasdf" as xyz,1233,cm_asdfasdf Can anyone help me on this?? (1 Reply)
Discussion started by: Sushir03
1 Replies

10. Shell Programming and Scripting

Parsing a textfile, sorting and doing math fucntions.

whats up all, I am very happy I joined this forum, I have learned alot just going through. I have a small dilemma... trying to parse a textfile, and sort by 1st feild and add up second feild.... cat textfile.in 1200, 2.50 1200, 1.00 1200, 3.00 1000, 1.00 1000, 2.00 1500, 10.00 1600,... (5 Replies)
Discussion started by: djsal
5 Replies
Login or Register to Ask a Question