# How to ignore delimiter between the quotes?

**URL:** <https://community.unix.com/t/how-to-ignore-delimiter-between-the-quotes/274972>\
**Category:** Shell Programming and Scripting\
**Created:** [October 8, 2010, 6:01am UTC](https://community.unix.com/t/how-to-ignore-delimiter-between-the-quotes/274972 "2010-10-08T06:01:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ganesh\_Khandare](https://community.unix.com/letter_avatar/ganesh_khandare/32/5_5575768a8748004e209b776fc1b2916d.png) [@Ganesh\_Khandare](https://community.unix.com/u/Ganesh_Khandare)\
**Post date:** [October 8, 2010, 6:01am UTC](https://community.unix.com/t/how-to-ignore-delimiter-between-the-quotes/274972/1 "2010-10-08T06:01:01Z")

</div>

Hi Guys,  
I have following script which counts number of tilde in file but i want to count tilde which are field saparator.but my script count tilde between word also what i need is if line is like

```nohighlight
abcd~das~1212~fsddf~

```

so tilde count is = 4  
if line like

```nohighlight
abcd~das~1212~fsd"~"df~

```

so tilda count is =4 onlly it should not give count as 5 that means it should ignor ~ between "~" if it comes in between the any word. Please give me solution in my script only.

```nohighlight
#!/bin/bash
WORK_DIR=/export/opt/rtrupld/autosys/scripts_old
DATA_DIR=/cdirect/rtrupld/incoming/intellect
DATA_DIR1=/cdirect/rtrupld/incoming/opics
data1=$DATA_DIR/INTELLECT_TOK_MMRTRCASHFLOW*.txt

if [$var1 = "INTELLECT"] && [$var2 = "TOK"]
then
  echo"-------------------------------ERROR IN CASHFLOW HANDOFF-------------------------------------------------"
{
nawk -v v1=`grep "INTELLECT_TOK_CASHFLOW_FLD_COUNT" $propfile | cut -d"=" -f2` -F'~' '{if (NF-1 != v1)
{print "Error in " $0 " at line number "NR " tilde count= " NF-1 }}' $data1
}

```

Here path just ignore it properties file value of INTELLECT\_TOK\_CASHFLOW\_FLD\_COUNT" is take count of tilde

Thanks & Regards,  
Ganesh.

---

<div class="post-metadata">

**Author:** ![Klashxx](https://community.unix.com/user_avatar/community.unix.com/klashxx/32/326_2.png) [@Klashxx](https://community.unix.com/u/Klashxx)\
**Post date:** [October 8, 2010, 7:21am UTC](https://community.unix.com/t/how-to-ignore-delimiter-between-the-quotes/274972/2 "2010-10-08T07:21:51Z")

</div>

Try:

```nohighlight
echo 'abcd~das~1212~fsd"~"df~' |perl -pe '$_=()=/\w~/g;'

```

---

<div class="post-metadata">

**Author:** ![ygemici](https://community.unix.com/letter_avatar/ygemici/32/5_5575768a8748004e209b776fc1b2916d.png) [@ygemici](https://community.unix.com/u/ygemici)\
**Post date:** [October 8, 2010, 2:52pm UTC](https://community.unix.com/t/how-to-ignore-delimiter-between-the-quotes/274972/3 "2010-10-08T14:52:07Z")

</div>

```nohighlight
# echo 'abcd~das~1212~fsd"~"df~' |sed 's/[^\"~\"]//g;s/\"~\"//g;s/.$//'|wc -c
4

```

---

<div class="post-metadata">

**Author:** ![fpmurphy](https://community.unix.com/user_avatar/community.unix.com/fpmurphy/32/110_2.png) [@fpmurphy](https://community.unix.com/u/fpmurphy)\
**Post date:** [October 8, 2010, 4:09pm UTC](https://community.unix.com/t/how-to-ignore-delimiter-between-the-quotes/274972/4 "2010-10-08T16:09:03Z")

</div>

Can even be done within a shell

```nohighlight
bash$ IN='abcd~das~1212~fsd"~"df~'
bash$ A=${IN//\"~\"/}; arr=( ${A//\~/ } ); echo ${#arr}
4
bash$

```

---

<div class="post-metadata">

**Author:** ![Scrutinizer](https://community.unix.com/user_avatar/community.unix.com/scrutinizer/32/1216_2.png) [@Scrutinizer](https://community.unix.com/u/Scrutinizer)\
**Post date:** [October 8, 2010, 7:21pm UTC](https://community.unix.com/t/how-to-ignore-delimiter-between-the-quotes/274972/5 "2010-10-08T19:21:41Z")

</div>

But what if the text inside the double quotes contains other characters than tilde. Then you would need something like this:

```nohighlight
$ echo 'abcd~das~1212~fsd"yyr~yyr"df~' | awk '{gsub(/"[^"]*"/,x);print gsub(/~/,x)}'
4

```
