Sponsored Content
Top Forums Shell Programming and Scripting How to separate a statement based on some delimiter and store each field in a variable? Post 302892721 by anbu23 on Friday 14th of March 2014 08:57:06 AM
Old 03-14-2014
In Bash
Code:
Variable1=MKT1,MKT2,MKT3,MKT4 
IFS=","
declare -a Arr=($Variable1);
echo ${#Arr[@]} #Number of elements in the array
echo ${#Arr}

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Cut a Variable into sub variables based on a delimiter

Hello All, I am novice on Shell Scripting. Any help on this is highly appreciated. I have a variable $VARIABLE="$some1|$some2|$some3" I need sub variables $SUBVAR1,$SUBVAR2,$SUBVAR3 which must be equal to $some1 , $some2 and $some3 respectively. It works fine with $SUBVAR1 =... (6 Replies)
Discussion started by: jingi1234
6 Replies

2. Shell Programming and Scripting

Set a variable field delimiter using awk

How can i set a variable field delimiter using awk?? I wanna do something like this ,but i canīt get the correct syntaxis : VARI=TEST echo "0121212TESTxvcshaashd"|awk 'FS="$VARI" {print $2}' Thanks. (2 Replies)
Discussion started by: Klashxx
2 Replies

3. Shell Programming and Scripting

Substring based on delimiter, finding last delimiter

Hi, I have a string like ABC.123.XYZ-A1-B2-P1-C4. I want to delimit the string based on "-" and then get result as only two strings. One with string till last hyphen and other with value after last hyphen... For this case, it would be something like first string as "ABC.123.XYZ-A1-B2-P1" and... (6 Replies)
Discussion started by: gupt_ash
6 Replies

4. Shell Programming and Scripting

Add field delimiter for the last field

I have a file with three fields and field delimiter '|' like: abc|12:13:45|123 xyz|12:87:32| qwe|54:21:09 In the file the 1st line has proper data -> abc|12:13:45|123 ,the 2nd line doesnt has data for the 3rd field which is okay , the 3rd line doesnt has data for the 3rd field as well the... (5 Replies)
Discussion started by: mehimadri
5 Replies

5. Shell Programming and Scripting

Extract text and store in separate files

Hi, I have a file which looks like this: .I 1 some text .A this is the first line .I 2 some text again .B this is the second line .I 3 again some text .C this is the third line I want to have my output like this in separate files: (7 Replies)
Discussion started by: shoaibjameel123
7 Replies

6. Shell Programming and Scripting

Shell script to put delimiter for a no delimiter variable length text file

Hi, I have a No Delimiter variable length text file with following schema - Column Name Data length Firstname 5 Lastname 5 age 3 phoneno1 10 phoneno2 10 phoneno3 10 sample data - ... (16 Replies)
Discussion started by: Gaurav Martha
16 Replies

7. Shell Programming and Scripting

Separate string based on delimiter

Hi, for fd in $(grep "/tmp/" hello.properties)The grep gives me the below output: deploydir=/tmp/app1/dfol prodir= /tmp/hello/prop ...... Now i want to store /tmp/app1/dfol then /tmp/hello/prop in a variable so that i can check if those folders files exists or not. The delimiter would... (4 Replies)
Discussion started by: mohtashims
4 Replies

8. Shell Programming and Scripting

How to separate based on delimiter?

Hi, Variable=MKT1,MKT2,MKT3 and so on i am trying to seperate MKT1,MKT2,MKT3 and store each in a variable. the values in variable1 may vary. I am using bash (8 Replies)
Discussion started by: arghadeep adity
8 Replies

9. Shell Programming and Scripting

How can awk ignore the field delimiter like comma inside a field?

We have a csv file as mentioned below and the requirement is to change the date format in file as mentioned below. Current file (file.csv) ---------------------- empname,date_of_join,dept,date_of_resignation ram,08/09/2015,sales,21/06/2016 "akash,sahu",08/10/2015,IT,21/07/2016 ... (6 Replies)
Discussion started by: gopal.biswal
6 Replies

10. Shell Programming and Scripting

Update a specific field in file with Variable value based on other Key Word

I have an input file with A=xyz B=pqr I would want the value in Second Field (xyz or pqr) updated with a value present in Shell Variable based on the value passed in the first field. (A or B ) while read line do NEW_VALUE = `some functionality done on $line` If $line=First Field-... (1 Reply)
Discussion started by: infernalhell
1 Replies
SXID.CONF(5)							File Formats Manual						      SXID.CONF(5)

NAME
sxid.conf - configuration settings for sxid DESCRIPTION
This is the configuration file used by sxid to define it's parameters for execution. By default it is /etc/sxid.conf but can be anything using the --config command line option for sxid. Options in this file are in the form of OPTION = "VALUE" . Note that the VALUE must be contained in double quotes. OPTIONS
ALWAYS_NOTIFY If sxid does not find any changes it will not send an email unless you specify "yes" here. ALWAYS_ROTATE Usually sxid will only rotate the log files when there is a change from the last run. This is usually best, since all logs will record a change rather than just a run of the program. If you want to rotate the logs every time sxid is run, regardless of changes, specify "yes" here. EMAIL Where to send the email containing the output of changes every time sxid is run. Example: EMAIL = "Great Admin <root@host.com>" ENFORCE Normally sxid only flags items which are suid or sgid and are in a FORBIDDEN directory. With this option set to "yes" sxid will remove the s[ug]id bit(s) on any files or directories it finds in forbidden directories and report any changes in the email. Note that directories listed in FORBIDDEN are searched regardless of whether or not they are listed in SEARCH. However, EXCLUDED options still apply to directories that fall under them. EXCLUDE A space seperated list of directories to exclude from the search. Note that if a SEARCH path falls under an EXCLUDE path that it will still be searched. This is useful for excluding whole directories and only specifying one. Example: SEARCH = "/usr /usr/src/linux" EXCLUDE = "/usr/src" EXTRA_LIST File that contains a list of (each on it's own line) of other files that sxid should monitor. This is useful for files that aren't +s, but relate to system integrity (tcpd, inetd, apache...). Example: EXTRA_LIST = "/etc/sxid.list" FORBIDDEN A space seperated list of directories that are not supposed to contain any suid or sgid items. Items which are suid or sgid in these directories are flagged in the email seperately from the other listings whether there are other changes or not. Example: FORBIDDEN = "/tmp /home" IGNORE_DIRS Ignore entries for directories in these paths. This means that only files will be recorded. You can effectively ignore all directory entries by setting this to "/". KEEP_LOGS This is a numerical value for how many log files to keep when rotating. LISTALL Forces a list of all entries to be included in th output. Implies ALWAYS_NOTIFY. LOG_FILE The full path of where to store the log files. These will be rotated, each rotated log being suffixed with a digit. The directories must already exist. This is usually /var/log/sxid.log. Rotated logs would look like /var/log/sxid.log.n where 'n' is the number in the rotation. The current log has no suffix. AIL_PROG Mail program. This changes the default compiled in mailer for reports. You only need this if you have changed it's location and don't want to recompile sxid. SEARCH A space seperated list of directories to search. Sxid will use these as a starting point for it's searches. Example: SEARCH = "/usr /bin /lib" AUTHOR
Ben Collins <bcollins@debian.org> REPORTING BUGS
Report bugs to current maintainer Timur Birsh <taem@linukz.org>. SEE ALSO
sxid(1) sXid 4.0.5 January 2002 SXID.CONF(5)
All times are GMT -4. The time now is 04:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy