Sponsored Content
Full Discussion: Minor changes to script
Contact Us Post Here to Contact Site Administrators and Moderators Minor changes to script Post 302921732 by ramyags on Monday 20th of October 2014 04:49:33 AM
Old 10-20-2014
Oracle Minor changes to script

isNumeric()
{
numericExpression='^[0-9]+$'
if ! [[ $1 =~ $numericExpression ]]
then
echo 1;
else
echo 0;
fi
}

getColumnData()
{
echo `echo $1|cut -d "," -f1,2 --output-delimiter " "`
}

containsSegment()
{
if [[ $1 =~ "LSNCS808" ]] || [[ $1 =~ "LSNCS097" ]] || [[ $1 =~ "LSNCS148" ]]
then
echo 0;
else
echo 1;
fi
}
FOLDER=/omnicron-space/Lifesys/Segdataconv/csv_files
EXTENSION=csv
SEGMENT_FILE=${FOLDER}/$1_SEGMENT.${EXTENSION}
NON_SEGMENT_FILE=${FOLDER}/$1_NONSEGMENT.${EXTENSION}



# Assuming the first column in the record is always numeric and it is the header of the record
# any line not following the above pattern will be treated as the data belong to the header record
# Skipping the first line in the file
echo " Processing the file $1..."
sed 1q $1 | tee $NON_SEGMENT_FILE >$SEGMENT_FILE
sed 1d $1 |while read line
do
firstCol=(`getColumnData $line`)
isRecordHeader=`isNumeric ${firstCol[0]}`;
if [[ $isRecordHeader =~ "0" ]]
then
if [[ `containsSegment ${firstCol[1]}` =~ "0" ]]
then
#The data has to be appended to the segment file
filetoAppend=$SEGMENT_FILE;
else
#the data has to be appended to the non segment file
filetoAppend=$NON_SEGMENT_FILE;
fi
echo $line >>"$filetoAppend"
else
echo $line >>"$filetoAppend"
fi
done

echo " Finished processing the file $1..."
echo " Generated the following files: $SEGMENT_FILE, $NON_SEGMENT_FILE"


please suggest wat changes to be done in the above script to look for the values in sixth column and search for pattern "VS KSDS"
 

8 More Discussions You Might Find Interesting

1. Programming

Device Major/Minor numbers

To further my fledgling knowledge of C, I am re-writing some of the Unix command set. My current command is an ls-style command. All works well, except for device files. How do I get the major/minor numbers for the dev files? I see from the stat struct there are st_rdev and st_dev members. Do... (1 Reply)
Discussion started by: zazzybob
1 Replies

2. Post Here to Contact Site Administrators and Moderators

minor issue on question that i had posted !!

to the moderators of this site... i posted a question several weeks ago about a egep -e if you look through my posts you will see that my question was fully plausible as a reasonable post that could have been answered even it was to say that I should search the man pages myself and find the... (4 Replies)
Discussion started by: moxxx68
4 Replies

3. UNIX for Dummies Questions & Answers

jus a minor issue. please assist if possible.

for an assignment i'm working on i have 2 minor issues with my code for the lines to be displayed after entering a line of code i.e:- $ ls- l foo1.c foo1.c not found $ recycle -rw-r--r-- 1 usr user 31 foo1.c -rw-r--r-- 1 usr user 31 foo2.c this is my working code . ... (1 Reply)
Discussion started by: jerryboy78
1 Replies

4. Solaris

Help with Major and minor number

Hi Does anyone know what the major and minor numbers are in Solaris? (2 Replies)
Discussion started by: wisdom
2 Replies

5. AIX

Difference between Major and Minor in AIX

Difference between Major and Minor in AIX (5 Replies)
Discussion started by: AIXlearner
5 Replies

6. Shell Programming and Scripting

How to filter out major and minor?

Hi, I have line like this : proj_name/module/trunk/module_1_0 where the first "1" refers to major version and second "0" refers to minor version. any AWK or command like that so that I can filter out the major and minor ? like major= command | input line minor= command |... (4 Replies)
Discussion started by: bhaskar_m
4 Replies

7. Shell Programming and Scripting

Minor Calculation Error

Hello everyone!! I got a slight problem doing some calculation from the text file. I able to get the specific data by cutting it using grep and cut. The amount can be calculated but the problem I faced now is even the field which I didnt cut is been calculated too. This is what I meant. The... (2 Replies)
Discussion started by: aLHaNz
2 Replies

8. Shell Programming and Scripting

Filtering my major and minor values

I want to remove all rows with a minor repeating count less than 30% compared to the major repeating count from my table. The values of a col(starting col 2) can assume is A,T,G,C and N. Each row has at least 2 values and at most 4 repeating values(out of ATGC). N is considered a missing value... (12 Replies)
Discussion started by: newbie83
12 Replies
LOCALE_GET_DISPLAY_SCRIPT(3)						 1					      LOCALE_GET_DISPLAY_SCRIPT(3)

Locale::getDisplayScript - Returns an appropriately localized display name for script of the input locale

	Object oriented style

SYNOPSIS
publicstatic string Locale::getDisplayScript (string $locale, [string $in_locale]) DESCRIPTION
Procedural style string locale_get_display_script (string $locale, [string $in_locale]) Returns an appropriately localized display name for script of the input locale. If is NULL then the default locale is used. PARAMETERS
o $locale - The locale to return a display script for o $in_locale - Optional format locale to use to display the script name RETURN VALUES
Display name of the script for the $locale in the format appropriate for $in_locale. EXAMPLES
Example #1 locale_get_display_script(3) example <?php echo locale_get_display_script('sl-Latn-IT-nedis', 'en'); echo "; "; echo locale_get_display_script('sl-Latn-IT-nedis', 'fr'); echo "; "; echo locale_get_display_script('sl-Latn-IT-nedis', 'de'); ?> Example #2 OO example <?php echo Locale::getDisplayScript('sl-Latn-IT-nedis', 'en'); echo "; "; echo Locale::getDisplayScript('sl-Latn-IT-nedis', 'fr'); echo "; "; echo Locale::getDisplayScript('sl-Latn-IT-nedis', 'de'); ?> The above example will output: Latin; latin; Lateinisch SEE ALSO
locale_get_display_name(3), locale_get_display_language(3), locale_get_display_region(3), locale_get_display_variant(3). PHP Documentation Group LOCALE_GET_DISPLAY_SCRIPT(3)
All times are GMT -4. The time now is 04:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy