Sponsored Content
Full Discussion: For loop using LABEL
Top Forums Shell Programming and Scripting For loop using LABEL Post 302865389 by CarloM on Friday 18th of October 2013 10:01:26 AM
Old 10-18-2013
Quote:
Originally Posted by renuk
But columns in both the for are different in one for i am removing 18,19 and in other for i am removing 12,13...so how can i use same for for both...
You can pass the field numbers as parameters as well.

Updating Ashkay's solution:
Code:
foo(){
              DELMT="|"
              for i in $1; 
                do
                    ABaC_COL_SL=`cut -d "$DELMT" -f$2,$3 "$i"|sort -u`
                    RM_ABaC_COL_SL=$DELMT""$ABaC_COL_SL
                    sed -n 's/'"$RM_ABaC_COL_SL"'//p' $i> $WORK_AREA_PATH/TDA_FILES/$i
               done
     }

if [ $SLS_COUNT -gt 0 ]; then
    FILE_NAME_SLS=`cat $FILE_PATH|grep 'GTDA_Dly_Sls_'`
    foo "$FILE_NAME_SLS" 18 19
    echo " GTDA sales done"
fi

if [ $PMIX_COUNT -gt 0 ]; then
    FILE_NAME_PMIX=`cat $FILE_PATH|grep 'GTDA_Dly_Pmix_'`
    foo "$FILE_NAME_PMIX" 12 13
    echo " GTDA Pmix done"
fi

EDIT: Given that $FILE_NAME_xxxx appears to be a list, you'll need to quote it when calling the function.

Last edited by CarloM; 10-18-2013 at 11:17 AM..
This User Gave Thanks to CarloM For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Solaris 8 label command

I have a RAID 5 set that is 100GB. i recently added more disks to the RAID so its now 225GB. In order for Solaris to recognize the new disk size i was told to lable the disk again. the disk is under Veritas Vol Mgr and File Sys control will i lose data if i do this? (3 Replies)
Discussion started by: justalogin01
3 Replies

2. 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

3. 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

4. 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

5. 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

6. UNIX for Advanced & Expert Users

how to write volume label / ID into CD

I've a peculiar requirement that, i want to write the md5sum of the ISO image in to CD or DVD where i write that ISO. If you want to write some other information as volume label/ID, we can use the mkisofs command's -V option. But i cannot use this because before the creation of the iso file,... (0 Replies)
Discussion started by: thegeek
0 Replies

7. 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

8. 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

9. UNIX for Dummies Questions & Answers

How to read a disk label?

Hi there, I'm wondering how to display a disk label (why not edit it but I don't need that yet). I found several commands on forums like disklabel and diskinfo but I can't find them on my system and don't know the package they belong to. Can you help me? Cheers Santiago (2 Replies)
Discussion started by: chebarbudo
2 Replies

10. 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
GRUB-RENDER-LABEL(1)                                               User Commands                                              GRUB-RENDER-LABEL(1)

NAME
grub-render-label - generate a .disk_label for Apple Macs. SYNOPSIS
grub-render-label [OPTION...] [OPTIONS] DESCRIPTION
Render Apple .disk_label. -b, --bgcolor=COLOR use COLOR for background -c, --color=COLOR use COLOR for text -f, --font=FILE use FILE as font (PF2). -i, --input=FILE read text from FILE. -o, --output=FILE set output filename. Default is STDOUT -t, --text=STRING set the label to render -v, --verbose print verbose messages. -?, --help give this help list --usage give a short usage message -V, --version print program version Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. REPORTING BUGS
Report bugs to <bug-grub@gnu.org>. SEE ALSO
The full documentation for grub-render-label is maintained as a Texinfo manual. If the info and grub-render-label programs are properly installed at your site, the command info grub-render-label should give you access to the complete manual. grub-render-label (GRUB) 2.02-2ubuntu8.3 July 2018 GRUB-RENDER-LABEL(1)
All times are GMT -4. The time now is 10:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy