how can i isolate the random sequence of numbers using awk?

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how can i isolate the random sequence of numbers using awk?
# 1  
Old 01-09-2008
how can i isolate the random sequence of numbers using awk?

as you can see there is a delimiter after c8 "::". Awk sees the rest as fields because it doesn't recognize spaces and tabs as delimiters. So i am basically looking to isolate 20030003ba13f6cc. Can anyone help?

c8::20030003ba13f6cc disk connected configured unknown
# 2  
Old 01-09-2008
dosen't matter iv'e got it working now

i am using this command and it seems to work

cfgadm -al c10 |grep "disk" | awk '{printf $1"\n"}' | cut -d':' -f3
# 3  
Old 01-09-2008
Here is a sed command to do it all:
$ echo "c8::20030003ba13f6cc disk connected configured unknown
> f9::8808080809 useless junk" |sed -n '/disk/s/[^:]*::\([^ ]*\) .*$/\1/p'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. BSD

Mcookie, pkg -l to generate random sequence

I am setting this thread to this bsd forum, though it may fit into bash. But as using bsd and the terminal, I would like to generate a random sequence of alphanumerical digits, such as I use to do so on linux by typing just mcookiethis one gives me a pretty random password, but it does not on bsd... (0 Replies)
Discussion started by: 1in10
0 Replies

2. Shell Programming and Scripting

Script to generate sequence of numbers

I need awk script to generate part number sequencing based on data in multiple columns like below Input File --------- Col A|Col B|Col C| 1|a|x| 2|b|y| |c|z| | |m| | |n| And out put should be like 1ax 1ay 1az 1am 1an 1bx 1by (6 Replies)
Discussion started by: aramacha
6 Replies

3. Shell Programming and Scripting

Help with appending random sequence to huge CDR file

Hi, I am in a terrible emergency. I have multiple cdr files with line count >6000. I need to append |0| | | | | | | |random| to end of each line. The random number should never repeat. Please help with a shell script to process all cdr's in a directory with above requirement. (23 Replies)
Discussion started by: shiburnair
23 Replies

4. Homework & Coursework Questions

Random numbers

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! Write a shell script that will take the sum of two random number? Ex: Random n1 +Random n2 = result i tries to write it but i had some dufficulties ... (3 Replies)
Discussion started by: renegade755
3 Replies

5. Shell Programming and Scripting

unique random numbers awk

Hi, I have a small piece of awk code (see below) that generates random numbers. gawk -F"," 'BEGIN { srand(); for (i = 1; i <= 30; i++) printf("%s AM329_%04d\n",$0,int(36 * rand())+1) }' OFS=, AM329_hole_names.csv The code works fine and generates alphanumeric numbers like AM329_0001,... (2 Replies)
Discussion started by: theflamingmoe
2 Replies

6. Shell Programming and Scripting

Using awk to isolate specific rows

Hi all! Let's say I have obtained this dataset from the ISI Web of Knowledge ... PT J AU Yousefi, Ramin Muhamad, Muhamad Rasat Zak, Ali Khorsand TI The effect of source temperature on morphological and optical properties of ZnO nanowires grown using a modified thermal... (17 Replies)
Discussion started by: sidiqmk
17 Replies

7. Shell Programming and Scripting

Need to find the gap in the sequence of numbers

Hi Guys, I have a file with numbers in sequence. The sequence have been broken somewhere.. I need to find out at which number the sequence has been broken... For an example, consider this sequence, it needs to give me output as 4 (as 5 is missing) and 6(as 7 is missing) Thanks for... (3 Replies)
Discussion started by: mac4rfree
3 Replies

8. Shell Programming and Scripting

awk: isolate a part of a file name

hi there, i have a file named 'x20080613_x20100106.pwr1.gc', i want to isolate the part 'x20080613_x20100106' but by using the following line i isolate the part '.pwr1.gc': `awk '$0=substr($0, length($0)-7)' $temp` how can i reverse that? thank you! (3 Replies)
Discussion started by: friend
3 Replies

9. Shell Programming and Scripting

Random numbers from 0 to 1000

Hello All, I want to make a simple script which generate random number from 0 to 1000. and simply display it. Plz HELP!!!!!! Regards, Waqas Ahmed (2 Replies)
Discussion started by: wakhan
2 Replies

10. UNIX for Dummies Questions & Answers

creating sequence numbers in unix

Hi, Is there a way to create sequence numbers in unix i have a set of batches(which contain records) and i want to assign a number to every batch. how can i do that? (1 Reply)
Discussion started by: dnat
1 Replies
Login or Register to Ask a Question