I need a special print


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers I need a special print
# 1  
Old 11-18-2009
I need a special print

I have this:

Code:
\2009_may\05-04-2009\05-04-2009(74)
\2009_may\05-04-2009\05-04-2009(74)\05-04-2009(74)_0-999
\2009_may\05-04-2009\05-04-2009(74)_left
\2009_may\05-04-2009\05-04-2009(74)_left\05-04-2009(74)
\2009_may\05-04-2009\05-04-2009(74)_right
\2009_may\05-04-2009\05-04-2009(74)_right\05-04-2009(74)
\2009_may\05-04-2009\05-04-2009(75)
\2009_may\05-04-2009\05-04-2009(75)\05-04-2009(75)_0-999
\2009_may\05-04-2009\05-04-2009(75)_left
\2009_may\05-04-2009\05-04-2009(75)_left\05-04-2009(75)
\2009_may\05-04-2009\05-04-2009(75)_right
\2009_may\05-04-2009\05-04-2009(75)_right\05-04-2009(75)

I want to print this:

Code:
\2009_may\05-04-2009\05-04-2009(74)
\2009_may\05-04-2009\05-04-2009(75)

I can
Code:
awk "/\)$/{print}"

but I would get this:

Code:
\2009_may\05-04-2009\05-04-2009(74)
\2009_may\05-04-2009\05-04-2009(74)_left\05-04-2009(74)
\2009_may\05-04-2009\05-04-2009(74)_right\05-04-2009(74)
\2009_may\05-04-2009\05-04-2009(75)
\2009_may\05-04-2009\05-04-2009(75)_left\05-04-2009(75)
\2009_may\05-04-2009\05-04-2009(75)_right\05-04-2009(75)

But I really want to print this:

Code:
\2009_may\05-04-2009\05-04-2009(74)
\2009_may\05-04-2009\05-04-2009(75)

Thanks,
Kenny.

Last edited by Franklin52; 11-18-2009 at 01:22 PM.. Reason: Please use code tags!!
# 2  
Old 11-18-2009
something like this:

Code:
#  cut -c1-35 infile | sort | uniq
\2009_may\05-04-2009\05-04-2009(74)
\2009_may\05-04-2009\05-04-2009(75)
or
#  sed 's/\([^)]*)\).*/\1/' infile | sort | uniq
\2009_may\05-04-2009\05-04-2009(74)
\2009_may\05-04-2009\05-04-2009(75)
or
#  nawk -F")" '!x[$1]++' infile
\2009_may\05-04-2009\05-04-2009(74)
\2009_may\05-04-2009\05-04-2009(75)

HTH
# 3  
Old 11-18-2009
try:

Code:
awk -F"\\"   ' NF==4 && $0 ~ /)$/ { print; } ' filename

# 4  
Old 11-18-2009
Another one Smilie:

Code:
awk -F")" '!$2' file

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to create a print filter that print text & image?

Currently, I have a print filter that takes a text file, that convert it into PCL which then gets to a HP printer. This works. Now I need to embedded a image file within the text file. I'm able to convert the image file into PCL and I can cat both files together to into a single document... (1 Reply)
Discussion started by: chedlee88-1
1 Replies

2. Shell Programming and Scripting

Find Special/Null/Control Chars and Print Line Numbers

Hi All, This might be a basic question... I need to write a script to find all/any Speacial/Null/Control Chars and Print Line Numbers from an input file. Output something like Null Characters in File Name at : Line Numbers Line = Print the line Control Characters in File Name at : Line... (2 Replies)
Discussion started by: Kevin Tivoli
2 Replies

3. Shell Programming and Scripting

Print every 5 lines with special condition

Hi Friends, I have an input file like this chr1 100 200 chr1 200 300 chr1 300 400 chr1 400 500 chr1 500 600 chr1 600 700 chr1 700 800 chr1 800 900 chr1 900 920 chr1 940 960 I would like to get the first line's second column and the fifth line's 3rd column as one single line. This... (13 Replies)
Discussion started by: jacobs.smith
13 Replies

4. Shell Programming and Scripting

Special format for numeric print out

Hi, I know this must be very simple and stupid question but I could not find a proper answer anywhere else, My script generates numeric values in the following format 3.01234567891E+03 I use %.11E in printf formatting, but I need to list my numbers as 0.30123456789E+04 basicly I... (14 Replies)
Discussion started by: hayreter
14 Replies

5. Shell Programming and Scripting

print all between patterns with special chars

Hi, I'm having trouble with awk print all characters between 2 patterns. I tried more then one solution found on this forum but with no success. Probably my mistakes are due to the special characters "" and "]"in the search patterns. Well, have a log file like this: logfile.txt ... (3 Replies)
Discussion started by: ginolatino
3 Replies

6. Shell Programming and Scripting

print first few lines, then apply regex on a specific column to print results.

abc.dat tty cpu tin tout us sy wt id 0 0 7 3 19 71 extended device statistics r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device 0.0 133.2 0.0 682.9 0.0 1.0 0.0 7.2 0 79 c1t0d0 0.2 180.4 0.1 5471.2 3.0 2.8 16.4 15.6 15 52 aaaaaa1-xx I want to skip first 5 line... (4 Replies)
Discussion started by: kchinnam
4 Replies

7. Shell Programming and Scripting

awk print $1 escape all special characters

I'm using awk '{print $1}' and it works most of the time to print the contents of a mysql query loop, but occationally I get a field with some special character in it, is there a way to tell awk to ignore all special characters between my FS? I have >186K records, so building a list of ALL special... (6 Replies)
Discussion started by: unclecameron
6 Replies

8. Shell Programming and Scripting

How to print range of lines using sed when pattern has special character "["

Hi, My input has much more lines, but few of them are below pin(IDF) { direction : input; drc_pinsigtype : signal; pin(SELDIV6) { direction : input; drc_pinsigtype : ... (3 Replies)
Discussion started by: nehashine
3 Replies

9. Shell Programming and Scripting

gawk print some special lines

Hi every body, i have this file example : TD1 TD2 TD3 . . .TDn <DIE_1> xxxxxx <\DIE_1> <TD1> information 1 inormation n <\TD1> <TDq> information (0 Replies)
Discussion started by: kamel.kimo
0 Replies

10. HP-UX

Print Problem in UNIX. Need to know the option to specify the print paper size

Hi, Could any one please let me know what is the option available in UNIX to print by specifying the paper size? We are using Unix11i. I could n't see any option specified in the 'lp' command to print the report by specifying the size of the paper. It would be of great help to me, if... (1 Reply)
Discussion started by: ukarthik
1 Replies
Login or Register to Ask a Question