Sed label question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sed label question
# 8  
Old 06-08-2012
Quote:
Originally Posted by Jazmania
Hi ygemici,


I'm trying to run the below awk command but I'm getting the following... -v: not found

Code:
echo " *** split out comma separated 'commands' into separate rows *** "
awk -F| -v OFS='\t' '
{n=split($3,a,/,/)
 for(i=1;i<=n;i++){
   $3=a[i]
   print  
 }
}' <${workfile}_2 | sort > ${workfile}_3


I'm thinking nawk might be whats needed instead but I can't figure out what the nawk command should be.. The man pages aren't that user friendly...
try this
Code:
# awk 'BEGIN{FS="|";OFS="\t "}{n=split($3,a,",");
for(i=1;i<=n;i++){$3=a[i];print}
}' <${workfile}_2 | sort > ${workfile}_3

and you can use nawk (or /usr/xpg4/bin/awk) instead of awk in solaris..

regards
ygemici
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Which IP label is used for HeartBeating?

Hi, In HACMP, which IP label ( Service/ Boot/ Persisten) is used for send/receive Heartbeat packets in IP based Heartbeating? (1 Reply)
Discussion started by: ksgnathan
1 Replies

2. Shell Programming and Scripting

For loop using LABEL

Hi, i have below code so i want to run only one for loop instead of two. if ; then FILE_NAME_SLS=`cat $FILE_PATH|grep 'GTDA_Dly_Sls_'` DELMT="|" for i in $FILE_NAME_SLS do ABaC_COL_SL=`cut -d "$DELMT"... (6 Replies)
Discussion started by: renuk
6 Replies

3. Solaris

Help:"Bad checksum in disk label" and "Can't open disk label package"?

Hello, I'm brand new to Sun/Solaris. I have a Sun Blade 150, with SunOS 5.8. I wanted to make a backup to prevent future data loss, so I put the disk in a normal PC with Windows XP to try to make a backup with Norton Ghost, the disk was detected, but not the file volume, so I place the disk... (6 Replies)
Discussion started by: Resadija
6 Replies

4. Shell Programming and Scripting

Using A Goto Label?

Im trying to do something like this but I cant find any documentation. read X if then goto ThisLine fi OTHER CODE OTHER CODE Label: ThisLine echo "You entered 1" (5 Replies)
Discussion started by: Grizzly
5 Replies

5. BSD

FreeBSD Label Editor Post-install Question

Hello there, Over the past few days I have installed FreeBSD 7.1 (which i'm new at) to an external Hard Drive. When installing, I chose to partition the disk Automatically and now I'm trying to use the label editor (post-installation configuration) to name the mount points: / /usr... (2 Replies)
Discussion started by: septima.pars
2 Replies

6. Shell Programming and Scripting

Sed Question 1. (Don't quite know how to use sed! Thanks)

Write a sed script to extract the year, rank, and stock for the most recent 10 years available in the file top10_mktval.csv, and output in the following format: ------------------------------ YEAR |RANK| STOCK ------------------------------ 2007 | 1 | Exxon... (1 Reply)
Discussion started by: beibeiatNY
1 Replies

7. AIX

Label: Fcp_array_err4

In errpt i have got the following error and my database performs slow. --------------------------------------------------------------------------- LABEL: FCP_ARRAY_ERR4 IDENTIFIER: D5385D18 Date/Time: Tue Jul 22 10:50:10 CUT Sequence Number: 193913 Machine Id: ... (1 Reply)
Discussion started by: vjm
1 Replies

8. HP-UX

Label printing help

Hi I need some help in label printing with Zebra printers. (Model 220xiII) Here is a small test label file which prints fine in portrait format. Can anyone tell me how to change the label printing mode to landscape format? HEADER;TESTLBL;1;1;5;4... (0 Replies)
Discussion started by: rpalghat
0 Replies

9. AIX

Label: Disk_err4

I was trying to access my filesystem "tools" but couldn't, so I run fsck, but says Unable to read superblock (TERMINATED) when try mounting says mount: /dev/lv01 on /tools: I/O error the state of logical volumes of rootvg are "open/stale", what does it means? LV NAME TYPE ... (4 Replies)
Discussion started by: andwhat
4 Replies

10. AIX

Label:scan_error_chrp

Am getting an error in error log LABEL: SCAN_ERROR_CHRP IDENTIFIER: BFE4C025 Date/Time: Wed May 17 10:49:32 CUT Sequence Number: 6738 Machine Id: 00CD552E4C00 Node Id: dbs104 Class: H Type: PERM Resource Name: sysplanar0 Resource Class:... (0 Replies)
Discussion started by: vjm
0 Replies
Login or Register to Ask a Question