awk, sed, grep...weird style


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk, sed, grep...weird style
# 8  
Old 05-16-2008
the best....
# 9  
Old 05-16-2008
Quote:
awk -F "*" '/xxx/ { print $2 }' file
awk: syntax error near line 1
awk: bailing out near line 1
# 10  
Old 05-18-2008
bump need help
# 11  
Old 05-18-2008
Quote:
Originally Posted by finalight
bump need help
Don't bump your question, forum rules

Code:
Vsl Voy Port Sz Cat Wt Block Slot Row Qty Crane OperCode ResvFor
carrier name 6113A xxxx 40 GP M U02 25 8 1 0
*some space* xxxx 40 HC M U02 25 8 1 0
*some space* xxxx 40 HC H U02 25 7 3 0

Please redefine your data sample.
# 12  
Old 05-19-2008
i can't do more than one spacing, but there are five spacing between the first word and the 0th position
# 13  
Old 05-20-2008
Try this:
Code:
 awk '/xxxx/{p="xxxx";print substr($0,index($0,p),length($0)+1-index($0,p))}' data.file


Last edited by danmero; 05-20-2008 at 01:31 AM.. Reason: make life complicated
# 14  
Old 05-20-2008
If you still need help, use code tags to post a properly formatted sample.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

changing c comments to c++ style with sed

Hi everyone, I've got a problem with converting C comments ( /* */ ) into C++ style ( // ) in some source file with sed. So far I've dealt with comments on one line, but I don't know how to convert when it is over multiple lines ... So I already have something like this: comments.sed ... (8 Replies)
Discussion started by: kolage
8 Replies

2. UNIX for Dummies Questions & Answers

grep/awk/sed?

Thread1 { x = 2 y = 10485 } Thread2 { x = 16 y = 1048 } Thread3 { x = 1 y = 1049 } Thread4 { x = 4 y = 1047 z = 500 } Suppose the above is a piece of code. I need to automate and verify that the value of x under Thread1's 2. There are several... (3 Replies)
Discussion started by: foxtron
3 Replies

3. Shell Programming and Scripting

help using sed/awk/grep

thanks for your reply. but i'm not quite sure what your code is doing. i may be using it wrong but i'm not getting what i'm supposed to get. could you please elaborate? thanks again, (6 Replies)
Discussion started by: kratos.
6 Replies

4. Shell Programming and Scripting

grep or awk or sed not sure which to use here

Hi All, I have a huge file, I need to two things from this file. I need to know the IP address or the hostname and second thing is the date&time. The file looks like this and I need to get my data from this... Trying... Connected to 204.109.172.117. Escape character is '^]'. Fri... (4 Replies)
Discussion started by: samnyc
4 Replies

5. UNIX for Dummies Questions & Answers

How could i get this by sed or grep or awk ????

------------------------------------------------------------------ Ex of Warning messgae,(Many similar lines occure for Both Test and Test1) -WARNING:Below Field not implemented in file File name: /home/test/ new/file1, msg buffer is: :Test:000948 ... (1 Reply)
Discussion started by: prsam
1 Replies

6. UNIX for Dummies Questions & Answers

Grep Sed or Awk?

I have two .txt files one called good.txt and the other one is called bad.txt. Both contain email addresses in the following format: john@john.com bob@bob.com sarah@sarah.com Basically, I want to scrub good.txt against bad.txt and save the resulting output in scrubbed.txt meaning that if... (2 Replies)
Discussion started by: holyearth
2 Replies

7. Shell Programming and Scripting

Sed | Awk | Grep

Can someone help me in understanding when to use SED, AWK and GREP (3 Replies)
Discussion started by: kn.naresh
3 Replies

8. Shell Programming and Scripting

weird behavior of grep -P

I met a problem in using grep -P. There is a text file, temp.txt, whose content is: dddd abc I ran the command: grep -P "\s*abc" temp.txt The result I expected is: abc But, the actual result is: dddd abc Could anyone tell me what is wrong? Thanks. (2 Replies)
Discussion started by: pankai
2 Replies

9. Shell Programming and Scripting

need help!!!awk,grep,sed

hi all by using cat /etc/passwd I've got these output. ajh1ect:x:839:501:Anthony:/home/ajh1ect:/bin/bash mjb1ect:x:840:501:Michael:/home/mjb1ect:/bin/bash mv3ect:x:841:501:Marian:/home/mv3ect:/bin/bash now I want to see just the user ID and group ID. so what is the code will be with... (2 Replies)
Discussion started by: nokia1100
2 Replies
Login or Register to Ask a Question