Issue while executing C executable with argument in shell script

Hi All,
I am new to this forum and also shell script :slight_smile:

My task is I have to read CSV file get the data from the file and use the data to call c executable with data as argument.And the output from c executable should be stored to new CSV file

Please find below my code

testfunction() { echo ${#1};./my_c_executable_file_name -l $1> op.txt; }
IFS=","
echo "Starting to read csv"
i=1
while read f1 f2
do
    echo "$f2";
    testfunction "$f2";
    value=$(<op.txt);
    echo $f1, $value >> output.csv

done < Book1.csv

Now the issue is the data coming from 1st CSV is around 804 characters, but when the code is executing the c executable it is not sending complete string in the argument.

I tried to remove \n but got an error file name too long.

Please help me for the same.

Thanks in advance

Try making the following changes and running your script again:
Change:

testfunction() { echo ${#1};./my_c_executable_file_name -l $1> op.txt; }

to:

testfunction() { echo ${#1};./my_c_executable_file_name -l "$1" > op.txt }

and change:

    echo $f1, $value >> output.csv

to:

    printf "%s,%s\n" "$f1" "$value" >> output.csv

Thank you for the reply

I tried with the modification as stated above but still I m getting the same error.

Still the executable is throwing error missing last part of string.

For your information
The data coming from CSV contains \n , \ and | among alpha numeric values.

I suspect these can be the issue for not sending the complete string to c executable.

Please let me know if there is any way I can resolve this.

In addition to Don's suggestions, I would keep IFS local to the read command instead of using it globally. Also try using -r to stop read from interpreting \ characters.

while IFS=, read -r f1 f2 f3 

The dummy third variable ( $f3 ) would need to be added only in case the csv has more than 2 fields, otherwise fields 3 and higher wind up in $f2 as well.

Thanks for the reply Sir

Let me provide you the example that will clear things
Data in CSV is

\
aadsa=1|dasdsa=adsada-4096|wedewq=sdsadasasdsa|wqewqe=weww-sadasd\
|C2S=004120F1707E4928|DOI=1225906924|DOE=1226511724|ISS=1|NUM=28036|CM\
T=chassis52license|LSP=22000|LSH=22000|LSG=11000|LSL=11000|LSC=10000|L\
EC=1000|LGT=11000|LSA=22000|FIS=Y|FR4=Y|FPP=Y|FTC=Y|FMG=Y|FCR=Y|FSR=Y|\
FPM=Y|FID=Y|FI6=Y|FLI=Y|FPF=Y|FFA=Y|FCA=Y|FUT=Y|FSS=Y|FDB=Y|FDA=Y|FTM=\
Y|FDU=Y|FTP=Y|FTA=Y|FFP=Y|FSA=Y|LIM=19100|LCC=19100|LPC=100|LIS=100|FD\
R=Y|BME=Y|qwewqe=Y|BSC=Y|FRC=Y|FMN=Y|FBM=Y|FDC=Y|FGR=Y|FAA=Y|FRF=Y|FDQ=Y|\
FEL=Y|FIN=Y|qeqweqw=Y|BKO=Y|BEP=Y|FIP=Y|FRO=Y|LSI=11000|LSR=11000|LSS=1100\
0|LSN=11000|qwewqe=Y|LSW=21000|FCC=Y|FCP=Y|LCF=1000|LPP=1000|FVM=Y|FVG=Y|\
FPD=Y|FPR=Y|FVA=Y|FES=Y|FSN=Y|FCD=Y|LSF=1000|FVI=Y|FON=Y|FLS=Y|FSG=Y|F\
qweqe=Y|qwewq=Y|wwqe=Y|adsa=Y|FPC=Y|asdasd=Y|ads=asdad/adaddadas+AU\
aasdasd/qweqwe

and when I tried Don's suggestion I am getting the error

missing  string ON=Y|FLS=Y|FSG=Y|F\
qweqe=Y|qwewq=Y|wwqe=Y|adsa=Y|FPC=Y|asdasd=Y|ads=asdad/adaddadas+AU\
aasdasd/qweqwe i.e the last part of the string.

I need the complete data to be sent to the c executable

trying Scrutinizer 's code the data is getting split on the basis of \ which is not the requirement.

But that file is not comma-separated, like your code sample suggested. I don't think it would qualify as a CSV. What is the structure of the file and what are you trying to feed into that function?

--
My suggestion does not split on the the basis of \ by the way, it refrains from interpreting \ , so it does not join the lines and and since you specified IFS="," , the literal lines in the file end up in field 1.

My aim is I am having the above format data, and I want to parse the data based on some logic that is present in c executable file.

Now the data count is around 2k so I thought to move the data to csv file and read it from the file and parse it and store to new csv file.

Is there any other solution for the same??

I am not aware of reading excel file so I chose for csv.

Please suggest me in case of any other solution.

Thanks

So, just to be clear:
You have told us that your input file contains two fields separated by a single comma. You have shown us that you want to take the field before the comma and copy it directly to your output file and that you want to take the field after the comma and replace it with the output produced by calling your C program with the option -l and one operand (the contents of the field after the comma).

But, there are no commas in your input, so the 1st field (the only field) is copied unchanged, a comma is added to the end, and your C program complains because the operand you pass to it is an empty string.

Therefore, we have no idea what you are trying to do.

So, forget your shell script. Stop calling your input file a comma separated values file (CSV) (since it apparently contains multiple fields but does not use comma as a separator). And, explain to us in English exactly what you are trying to do.

Show us explicit sample input (containing at least two records to be processed).
Then show us the exact arguments that should be passed to your C program for each input record, the output produced by your C program for those inputs, and the exact output file that should be produced from the given sample input file.

1 Like

(Apologies for any typos.)

As a complete novice myself let us concentrate on your C executable.

Is your C executable on the your Governments Secrets List, or can you explain
EXACTLY what it does?

Can the whole be done via the default command structure of your particular shell?
If not, then is that what is your C executable is for.
(At this point a cannot imagine the shell command structure to be unable to do
anything that you want on the file extract given.)

If so, then attempt basic shell scripting first on a small subset of your database
to get a working model. It may perform like a _Sloth_ but by the time these guys
have figured out your problem from incorrect information your _Sloth_ script will
have done its job!

Now to the basics...
What is your machine, OS, shell, terminal etc?

These guys have made an assumption that your file is CSV, erm, meaning
COMMA separated variable(s), as far as I am aware.
Fair assumption to make when you quote it, then we see it has fields are separated
by pipes, let us call them PSVs. You HAVE to make assumptions that newlines and
MAYBE even carriage returns. (^M), exist and code for them too.

Why not convert your file to filename.CSV first as that is what you C executable
looks as though it requires and try again OR alter the C code to work on this PSV
format instead?

The professionals on here will give the results you want so long as you give them
the WHOLE information. These guys have been attempting ESP, (Extra Sensory
Perception), for years but sadly none of them have succeeded yet so give them
a fighting chance. If anyone can figure out stuff these guys can...

Even I, as a total novice, might be able to chip in but not as it stands with the
conflicting information you are giving.

My bad, was not able to put it straight to u all. My apologies plz.

Let me provide u sample and I think this time I will be clear

So Input is

1, 
\ aadsa=1|dasdsa=adsada-4096|wedewq=sdsadasasdsa|wqewqe=weww-sadasd\ |C2S=004120F1707E4928|DOI=1225906924|DOE=1226511724|ISS=1|NUM=28036|CM\ T=chassis52license|LSP=22000|LSH=22000|LSG=11000|LSL=11000|LSC=10000|L\ EC=1000|LGT=11000|LSA=22000|FIS=Y|FR4=Y|FPP=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EL=Y|FIN=Y|qeqweqw=Y|BKO=Y|BEP=Y|FIP=Y|FRO=Y|LSI=11000|LSR=11000|LSS=1100\ 0|LSN=11000|qwewqe=Y|LSW=21000|FCC=Y|FCP=Y|LCF=1000|LPP=1000|FVM=Y|FVG=Y|\ FPD=Y|FPR=Y|FVA=Y|FES=Y|FSN=Y|FCD=Y|LSF=1000|FVI=Y|FON=Y|FLS=Y|FSG=Y|F\ qweqe=Y|qwewq=Y|wwqe=Y|adsa=Y|FPC=Y|asdasd=Y|ads=asdad/adaddadas+AU\ aasdasd/qweqwe

Now my aim is to create an output with
1, processed string using extracted string from input and executing c executable
2, processed string using extracted string from input and executing c executable

Input is in excel, but since I was not able to read excel from shell script so I converted the excel file in CSV which I can read using shell script.

Using the suggestions and the prev code the c executable is not getting the complete string that was extracted from input.

Hope now I am able to express my problem clearly.

I decided to do a PSV to CSV longhand for fun:-

#!/bin/bash --posix
# Done longhand to show that the default shell can convert.
# Your example 'PSV' file...
text="aadsa=1|dasdsa=adsada-4096|wedewq=sdsadasasdsa|wqewqe=weww-sadasd\
|C2S=004120F1707E4928|DOI=1225906924|DOE=1226511724|ISS=1|NUM=28036|CM\
T=chassis52license|LSP=22000|LSH=22000|LSG=11000|LSL=11000|LSC=10000|L\
EC=1000|LGT=11000|LSA=22000|FIS=Y|FR4=Y|FPP=Y|FTC=Y|FMG=Y|FCR=Y|FSR=Y|\
FPM=Y|FID=Y|FI6=Y|FLI=Y|FPF=Y|FFA=Y|FCA=Y|FUT=Y|FSS=Y|FDB=Y|FDA=Y|FTM=\
Y|FDU=Y|FTP=Y|FTA=Y|FFP=Y|FSA=Y|LIM=19100|LCC=19100|LPC=100|LIS=100|FD\
R=Y|BME=Y|qwewqe=Y|BSC=Y|FRC=Y|FMN=Y|FBM=Y|FDC=Y|FGR=Y|FAA=Y|FRF=Y|FDQ=Y|\
FEL=Y|FIN=Y|qeqweqw=Y|BKO=Y|BEP=Y|FIP=Y|FRO=Y|LSI=11000|LSR=11000|LSS=1100\
0|LSN=11000|qwewqe=Y|LSW=21000|FCC=Y|FCP=Y|LCF=1000|LPP=1000|FVM=Y|FVG=Y|\
FPD=Y|FPR=Y|FVA=Y|FES=Y|FSN=Y|FCD=Y|LSF=1000|FVI=Y|FON=Y|FLS=Y|FSG=Y|F\
qweqe=Y|qwewq=Y|wwqe=Y|adsa=Y|FPC=Y|asdasd=Y|ads=asdad/adaddadas+AU\
aasdasd/qweqwe"
echo -n "$text" > /tmp/psvfile
# Note the line separaters '\' are GONE!
# Now re-use the 'text' variable.
text=$(cat < /tmp/psvfile)
echo "$text"
# Get length of file.
file_len="${#text}"
echo "$file_len"
# Quick visual check to see if files are identical.
echo "$text"
csvtext=""
comma=","
# Ensure file_len offset does not over flow...
file_len=$[ ( file_len -1 ) ]
for n in $( seq 0 1 $file_len )
do
	if [ "${text:n:1}" == "|" ]
	then newtext=$newtext$comma
	else newtext=$newtext${text:n:1}
	fi
done
echo "$newtext"
echo -n "$newtext" > /tmp/csvfile
cat < /tmp/csvfile
echo -e "\n\nYou now have a CSV file.\n"
# Done!

And the results:-

Last login: Sat Oct 19 11:17:54 on ttys000
AMIGA:barrywalker~> ./psv_csv.sh
aadsa=1|dasdsa=adsada-4096|wedewq=sdsadasasdsa|wqewqe=weww-sadasd|C2S=004120F1707E4928|DOI=1225906924|DOE=1226511724|ISS=1|NUM=28036|CMT=chassis52license|LSP=22000|LSH=22000|LSG=11000|LSL=11000|LSC=10000|LEC=1000|LGT=11000|LSA=22000|FIS=Y|FR4=Y|FPP=Y|FTC=Y|FMG=Y|FCR=Y|FSR=Y|FPM=Y|FID=Y|FI6=Y|FLI=Y|FPF=Y|FFA=Y|FCA=Y|FUT=Y|FSS=Y|FDB=Y|FDA=Y|FTM=Y|FDU=Y|FTP=Y|FTA=Y|FFP=Y|FSA=Y|LIM=19100|LCC=19100|LPC=100|LIS=100|FDR=Y|BME=Y|qwewqe=Y|BSC=Y|FRC=Y|FMN=Y|FBM=Y|FDC=Y|FGR=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as+AUaasdasd/qweqwe
aadsa=1,dasdsa=adsada-4096,wedewq=sdsadasasdsa,wqewqe=weww-sadasd,C2S=004120F1707E4928,DOI=1225906924,DOE=1226511724,ISS=1,NUM=28036,CMT=chassis52license,LSP=22000,LSH=22000,LSG=11000,LSL=11000,LSC=10000,LEC=1000,LGT=11000,LSA=22000,FIS=Y,FR4=Y,FPP=Y,FTC=Y,FMG=Y,FCR=Y,FSR=Y,FPM=Y,FID=Y,FI6=Y,FLI=Y,FPF=Y,FFA=Y,FCA=Y,FUT=Y,FSS=Y,FDB=Y,FDA=Y,FTM=Y,FDU=Y,FTP=Y,FTA=Y,FFP=Y,FSA=Y,LIM=19100,LCC=19100,LPC=100,LIS=100,FDR=Y,BME=Y,qwewqe=Y,BSC=Y,FRC=Y,FMN=Y,FBM=Y,FDC=Y,FGR=Y,FAA=Y,FRF=Y,FDQ=Y,FEL=Y,FIN=Y,qeqweqw=Y,BKO=Y,BEP=Y,FIP=Y,FRO=Y,LSI=11000,LSR=11000,LSS=11000,LSN=11000,qwewqe=Y,LSW=21000,FCC=Y,FCP=Y,LCF=1000,LPP=1000,FVM=Y,FVG=Y,FPD=Y,FPR=Y,FVA=Y,FES=Y,FSN=Y,FCD=Y,LSF=1000,FVI=Y,FON=Y,FLS=Y,FSG=Y,Fqweqe=Y,qwewq=Y,wwqe=Y,adsa=Y,FPC=Y,asdasd=Y,ads=asdad/adaddadas+AUaasdasd/qweqwe
aadsa=1,dasdsa=adsada-4096,wedewq=sdsadasasdsa,wqewqe=weww-sadasd,C2S=004120F1707E4928,DOI=1225906924,DOE=1226511724,ISS=1,NUM=28036,CMT=chassis52license,LSP=22000,LSH=22000,LSG=11000,LSL=11000,LSC=10000,LEC=1000,LGT=11000,LSA=22000,FIS=Y,FR4=Y,FPP=Y,FTC=Y,FMG=Y,FCR=Y,FSR=Y,FPM=Y,FID=Y,FI6=Y,FLI=Y,FPF=Y,FFA=Y,FCA=Y,FUT=Y,FSS=Y,FDB=Y,FDA=Y,FTM=Y,FDU=Y,FTP=Y,FTA=Y,FFP=Y,FSA=Y,LIM=19100,LCC=19100,LPC=100,LIS=100,FDR=Y,BME=Y,qwewqe=Y,BSC=Y,FRC=Y,FMN=Y,FBM=Y,FDC=Y,FGR=Y,FAA=Y,FRF=Y,FDQ=Y,FEL=Y,FIN=Y,qeqweqw=Y,BKO=Y,BEP=Y,FIP=Y,FRO=Y,LSI=11000,LSR=11000,LSS=11000,LSN=11000,qwewqe=Y,LSW=21000,FCC=Y,FCP=Y,LCF=1000,LPP=1000,FVM=Y,FVG=Y,FPD=Y,FPR=Y,FVA=Y,FES=Y,FSN=Y,FCD=Y,LSF=1000,FVI=Y,FON=Y,FLS=Y,FSG=Y,Fqweqe=Y,qwewq=Y,wwqe=Y,adsa=Y,FPC=Y,asdasd=Y,ads=asdad/adaddadas+AUaasdasd/qweqwe

You now have a CSV file.

AMIGA:barrywalker~> _

@wisecracker

You have seen my last post?

I dont think the solution provided by you will help me?

Please correct me if I m wrong

OK, with your latest input file (apparently no newlines after the backslashes), try this:

while IFS=, read f1 dummy; IFS= read -r f2
do
  printf "f1:%s\nf2:%s\n" "$f1" "$f2"
done < file

Note: the printf statement inside the loop is just there just to demonstrate what $f1 contains and what $f2 contains. It produces:

f1:1
f2:\ aadsa=1|dasdsa=adsada-4096|wedewq=sdsadasasdsa|wqewqe=weww-sadasd\ |C2S=004120F1707E4928|DOI=1225906924|DOE=1226511724|ISS=1|NUM=28036|CM\ T=chassis52license|LSP=22000|LSH=22000|LSG=11000|LSL=11000|LSC=10000|L\ EC=1000|LGT=11000|LSA=22000|FIS=Y|FR4=Y|FPP=Y|FTC=Y|FMG=Y|FCR=Y|FSR=Y|\ FPM=Y|FID=Y|FI6=Y|FLI=Y|FPF=Y|FFA=Y|FCA=Y|FUT=Y|FSS=Y|FDB=Y|FDA=Y|FTM=\ Y|FDU=Y|FTP=Y|FTA=Y|FFP=Y|FSA=Y|LIM=19100|LCC=19100|LPC=100|LIS=100|FD\ R=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Y|LSF=1000|FVI=Y|FON=Y|FLS=Y|FSG=Y|F\ qweqe=Y|qwewq=Y|wwqe=Y|adsa=Y|FPC=Y|asdasd=Y|ads=asdad/adaddadas+AU\ aasdasd/qweqwe

Basically after \ I have new line i dont know why it is not been displayed in the web site.

I tried the code but the output was not same as new line was present

We don't know why you can't show us your input file either. I assume that by now you realize that you are making it very hard for us to help you.

Are you saying that this is what your input file looks like:

1,
\
aadsa=1|dasdsa=adsada-4096|wedewq=sdsadasasdsa|wqewqe=weww-sadasd\
|C2S=004120F1707E4928|DOI=1225906924|DOE=1226511724|ISS=1|NUM=28036|CM\
T=chassis52license|LSP=22000|LSH=22000|LSG=11000|LSL=11000|LSC=10000|L\
EC=1000|LGT=11000|LSA=22000|FIS=Y|FR4=Y|FPP=Y|FTC=Y|FMG=Y|FCR=Y|FSR=Y|\
FPM=Y|FID=Y|FI6=Y|FLI=Y|FPF=Y|FFA=Y|FCA=Y|FUT=Y|FSS=Y|FDB=Y|FDA=Y|FTM=\
Y|FDU=Y|FTP=Y|FTA=Y|FFP=Y|FSA=Y|LIM=19100|LCC=19100|LPC=100|LIS=100|FD\
R=Y|BME=Y|qwewqe=Y|BSC=Y|FRC=Y|FMN=Y|FBM=Y|FDC=Y|FGR=Y|FAA=Y|FRF=Y|FDQ=Y|\
FEL=Y|FIN=Y|qeqweqw=Y|BKO=Y|BEP=Y|FIP=Y|FRO=Y|LSI=11000|LSR=11000|LSS=1100\
0|LSN=11000|qwewqe=Y|LSW=21000|FCC=Y|FCP=Y|LCF=1000|LPP=1000|FVM=Y|FVG=Y|\
FPD=Y|FPR=Y|FVA=Y|FES=Y|FSN=Y|FCD=Y|LSF=1000|FVI=Y|FON=Y|FLS=Y|FSG=Y|F\
qweqe=Y|qwewq=Y|wwqe=Y|adsa=Y|FPC=Y|asdasd=Y|ads=asdad/adaddadas+AU\
aasdasd/qweqwe
2, 
\
aadsa=1|dasdsa=adsada-4096|wedewq=sdsadasasdsa|wqewqe=weww-sadasd\
|C2S=004120F1707E4928|DOI=1225906924|DOE=1226511724|ISS=1|NUM=28036|CM\
T=chassis52license|LSP=22000|LSH=22000|LSG=11000|LSL=11000|LSC=10000|L\
EC=1000|LGT=11000|LSA=22000|FIS=Y|FR4=Y|FPP=Y|FTC=Y|FMG=Y|FCR=Y|FSR=Y|\
FPM=Y|FID=Y|FI6=Y|FLI=Y|FPF=Y|FFA=Y|FCA=Y|FUT=Y|FSS=Y|FDB=Y|FDA=Y|FTM=\
Y|FDU=Y|FTP=Y|FTA=Y|FFP=Y|FSA=Y|LIM=19100|LCC=19100|LPC=100|LIS=100|FD\
R=Y|BME=Y|qwewqe=Y|BSC=Y|FRC=Y|FMN=Y|FBM=Y|FDC=Y|FGR=Y|FAA=Y|FRF=Y|FDQ=Y|\
FEL=Y|FIN=Y|qeqweqw=Y|BKO=Y|BEP=Y|FIP=Y|FRO=Y|LSI=11000|LSR=11000|LSS=1100\
0|LSN=11000|qwewqe=Y|LSW=21000|FCC=Y|FCP=Y|LCF=1000|LPP=1000|FVM=Y|FVG=Y|\
FPD=Y|FPR=Y|FVA=Y|FES=Y|FSN=Y|FCD=Y|LSF=1000|FVI=Y|FON=Y|FLS=Y|FSG=Y|F\
qweqe=Y|qwewq=Y|wwqe=Y|adsa=Y|FPC=Y|asdasd=Y|ads=asdad/adaddadas+AU\
aasdasd/qweqwe

or perhaps,

1,\
aadsa=1|dasdsa=adsada-4096|wedewq=sdsadasasdsa|wqewqe=weww-sadasd\
|C2S=004120F1707E4928|DOI=1225906924|DOE=1226511724|ISS=1|NUM=28036|CM\
T=chassis52license|LSP=22000|LSH=22000|LSG=11000|LSL=11000|LSC=10000|L\
EC=1000|LGT=11000|LSA=22000|FIS=Y|FR4=Y|FPP=Y|FTC=Y|FMG=Y|FCR=Y|FSR=Y|\
FPM=Y|FID=Y|FI6=Y|FLI=Y|FPF=Y|FFA=Y|FCA=Y|FUT=Y|FSS=Y|FDB=Y|FDA=Y|FTM=\
Y|FDU=Y|FTP=Y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FVG=Y|\
FPD=Y|FPR=Y|FVA=Y|FES=Y|FSN=Y|FCD=Y|LSF=1000|FVI=Y|FON=Y|FLS=Y|FSG=Y|F\
qweqe=Y|qwewq=Y|wwqe=Y|adsa=Y|FPC=Y|asdasd=Y|ads=asdad/adaddadas+AU\
aasdasd/qweqwe

or (what would seem more logical):

1,aadsa=1|dasdsa=adsada-4096|wedewq=sdsadasasdsa|wqewqe=weww-sadasd\
|C2S=004120F1707E4928|DOI=1225906924|DOE=1226511724|ISS=1|NUM=28036|CM\
T=chassis52license|LSP=22000|LSH=22000|LSG=11000|LSL=11000|LSC=10000|L\
EC=1000|LGT=11000|LSA=22000|FIS=Y|FR4=Y|FPP=Y|FTC=Y|FMG=Y|FCR=Y|FSR=Y|\
FPM=Y|FID=Y|FI6=Y|FLI=Y|FPF=Y|FFA=Y|FCA=Y|FUT=Y|FSS=Y|FDB=Y|FDA=Y|FTM=\
Y|FDU=Y|FTP=Y|FTA=Y|FFP=Y|FSA=Y|LIM=19100|LCC=19100|LPC=100|LIS=100|FD\
R=Y|BME=Y|qwewqe=Y|BSC=Y|FRC=Y|FMN=Y|FBM=Y|FDC=Y|FGR=Y|FAA=Y|FRF=Y|FDQ=Y|\
FEL=Y|FIN=Y|qeqweqw=Y|BKO=Y|BEP=Y|FIP=Y|FRO=Y|LSI=11000|LSR=11000|LSS=1100\
0|LSN=11000|qwewqe=Y|LSW=21000|FCC=Y|FCP=Y|LCF=1000|LPP=1000|FVM=Y|FVG=Y|\
FPD=Y|FPR=Y|FVA=Y|FES=Y|FSN=Y|FCD=Y|LSF=1000|FVI=Y|FON=Y|FLS=Y|FSG=Y|F\
qweqe=Y|qwewq=Y|wwqe=Y|adsa=Y|FPC=Y|asdasd=Y|ads=asdad/adaddadas+AU\
aasdasd/qweqwe
2,aadsa=1|dasdsa=adsada-4096|wedewq=sdsadasasdsa|wqewqe=weww-sadasd\
|C2S=004120F1707E4928|DOI=1225906924|DOE=1226511724|ISS=1|NUM=28036|CM\
T=chassis52license|LSP=22000|LSH=22000|LSG=11000|LSL=11000|LSC=10000|L\
EC=1000|LGT=11000|LSA=22000|FIS=Y|FR4=Y|FPP=Y|FTC=Y|FMG=Y|FCR=Y|FSR=Y|\
FPM=Y|FID=Y|FI6=Y|FLI=Y|FPF=Y|FFA=Y|FCA=Y|FUT=Y|FSS=Y|FDB=Y|FDA=Y|FTM=\
Y|FDU=Y|FTP=Y|FTA=Y|FFP=Y|FSA=Y|LIM=19100|LCC=19100|LPC=100|LIS=100|FD\
R=Y|BME=Y|qwewqe=Y|BSC=Y|FRC=Y|FMN=Y|FBM=Y|FDC=Y|FGR=Y|FAA=Y|FRF=Y|FDQ=Y|\
FEL=Y|FIN=Y|qeqweqw=Y|BKO=Y|BEP=Y|FIP=Y|FRO=Y|LSI=11000|LSR=11000|LSS=1100\
0|LSN=11000|qwewqe=Y|LSW=21000|FCC=Y|FCP=Y|LCF=1000|LPP=1000|FVM=Y|FVG=Y|\
FPD=Y|FPR=Y|FVA=Y|FES=Y|FSN=Y|FCD=Y|LSF=1000|FVI=Y|FON=Y|FLS=Y|FSG=Y|F\
qweqe=Y|qwewq=Y|wwqe=Y|adsa=Y|FPC=Y|asdasd=Y|ads=asdad/adaddadas+AU\
aasdasd/qweqwe

If I guessed correctly that one of the above three accurately describes what is in the input file you're going to feed into this shell script in the file named Book1.csv, which one is it? If it isn't one of these three and you can't accurately describe what your input file looks like, I don't see how we can help you.

And then, what string does your C program want as its operand? Should it be a string including the backslash character newline character pairs, or a string with the backslash character newline character pairs removed. Should there be a trailing newline character in that string, or not?

And finally, what does the output from your C program look like? Will it contain any comma, backslash, single quote, double quote, or newline characters. If the output contains a newline character, is it just one at the end of the output, or are there embedded newlines? If there are embedded newlines, are they all the second character in a backslash newline character pair?

Please help us help you; answer all of the above questions explicitly!