Sponsored Content
Full Discussion: Back quote problem
Homework and Emergencies Homework & Coursework Questions Back quote problem Post 302924876 by scopiop on Wednesday 12th of November 2014 09:27:04 PM
Old 11-12-2014
Back quote problem

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
Print out problem with line follow:

Code:
echo There are '$cat $fname | wc -l' contacts in database

how do I replace single quote with a backquote from Vi or nano?

2. Relevant commands, code, scripts, algorithms:

Code:
#!/bin/bash

#export all output to fname

fname=names.dat

echo "Please Enter your contact name as follow:"

echo "Given name: "
read name

echo "Surname: "
read surname

echo "Street address"
read street

echo "City you live in"
read city

echo "States"
read states

echo "Zip code"
read zipcode

echo $name   $surname   $street   $city   $states   $zipcode >> $fname

{
 echo
 echo Here are the current contacts in the database:
 echo
 cat $fname

} | more

echo There are "$cat $fname | wc -l" contacts in database


3. The attempts at a solution (include all code and scripts):
Code:
There are  names.dat | wc -l contacts in database

My attempt to printout how many users in database

4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
This does not relate to my school work.. Addition info that I learn from my own.

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Last edited by scopiop; 11-12-2014 at 11:53 PM.. Reason: Add CODE tags.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

back up problem

Hi all I am facing some problem taking INCREMENTAL Back up of file systems...........Actually i have mounted the file system of one server in another server..as i don't have tape drive in both servers...............i am using HPUX(L class and C class)servers.. can any one help me ... (1 Reply)
Discussion started by: Prafulla
1 Replies

2. Shell Programming and Scripting

Problem with double quote and string variable

Hello, i have a file output.txt which contains a single line with a list of files with quotes : "file1.ext" "file2.ext" "file3.ext" In a shell script, I want to retrieve the line and use it as a variable in a command like : zip archive.zip $LIST I cant get it work. When I physically type... (6 Replies)
Discussion started by: mattemp
6 Replies

3. Shell Programming and Scripting

Capturing Data between first quote and next quote

I have input file like RDBMS FALIURE UTY8703 'USER_WORK.TEST' .HIghest return code '12' I want to parse data which comed between first quote till next quote USER_WORK.TEST can you please suggest how to do that (4 Replies)
Discussion started by: scorp_rahul23
4 Replies

4. Shell Programming and Scripting

single quote problem with rsync

Hi everybody, I'm a newbie and hope that someone help me in this problem. I have a filename in LINUX with single quote like this: abs@hosttest:~/ABS/BETY/cygdrive/C/DECLARANOT 1.1.4/02 - ROCK/052 - GUNSROSES> dir You* -rw-r--r-- 1 abs users 2365881 2008-08-25 09:16 You're Crazy.mp3 ... (9 Replies)
Discussion started by: mr_boysito
9 Replies

5. Shell Programming and Scripting

Regex in grep to match all lines ending with a double quote (") OR a single quote (')

Hi, I've been trying to write a regex to use in egrep (in a shell script) that'll fetch the names of all the files that match a particular pattern. I expect to match the following line in a file: Name = "abc" The regex I'm using to match the same is: egrep -l '(^) *= *" ** *"$' /PATH_TO_SEARCH... (6 Replies)
Discussion started by: NanJ
6 Replies

6. Shell Programming and Scripting

replacing a quote in some lines with multiple quote fields

i want to replace mistaken quotes in line starting with tag 300 and relocate the quote in the correct position so the input is 223;25 224;20100428064823;1;0;0;0;0;0;0;0;8;1;3;9697;18744;;;;;;;;;;;; 300;X;Event:... (3 Replies)
Discussion started by: wradwan
3 Replies

7. Shell Programming and Scripting

remsh problem with single quote (')

Hi All, Im executing the shell script remotely. here is one statement from that: remsh $rHost -l $rUser "java -jar $TARGET/toolkit/apps/bin/toolkit-stm.jar network -m -d1 /abmusr06/abm/users/dywrk01/$package/DYP_Execution/data/configuration/network_aus/network -u2... (1 Reply)
Discussion started by: AB10
1 Replies

8. Shell Programming and Scripting

quote problem

Hi Everyone hwo are you i have one file "abc.txt" which contains record like this "1","2","3" "3","4","5" now i want to change above 2 to 5 so i write the code as awk ' BEGIN{FS=","} { if(NR==1) { print $1",5","$3 } else { print $0 } ' abc.txt but the outpute is "1",5,"3"... (5 Replies)
Discussion started by: aishsimplesweet
5 Replies

9. Homework & Coursework Questions

Problem with using using quote in awk script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: i have the output of a csh script piped to an awk script. In the awk script i was trying to assign a variable... (3 Replies)
Discussion started by: ymc1g11
3 Replies

10. Shell Programming and Scripting

Replacing all but the first and last double quote in a line with a single quote with awk

From: 1,2,3,4,5,This is a test 6,7,8,9,0,"This, is a test" 1,9,2,8,3,"This is a ""test""" 4,7,3,1,8,"""" To: 1,2,3,4,5,This is a test 6,7,8,9,0,"This; is a test" 1,9,2,8,3,"This is a ''test''" 4,7,3,1,8,"''"Is there an easy syntax I'm overlooking? There will always be an odd number... (5 Replies)
Discussion started by: Michael Stora
5 Replies
MSSQL_NUM_FIELDS(3)													       MSSQL_NUM_FIELDS(3)

mssql_num_fields - Gets the number of fields in result

SYNOPSIS
int mssql_num_fields (resource $result) DESCRIPTION
mssql_num_fields(3) returns the number of fields in a result set. PARAMETERS
o $result - The result resource that is being evaluated. This result comes from a call to mssql_query(3). RETURN VALUES
Returns the number of fields, as an integer. EXAMPLES
Example #1 mssql_num_fields(3) example <?php // Connect to MSSQL and select the database $link = mssql_connect('KALLESPCSQLEXPRESS', 'sa', 'phpfi'); mssql_select_db('php', $link); // Select some data from our database $data = mssql_query('SELECT [name], [age] FROM [php].[dbo].[persons]'); // Construct a table echo '<table border="1">'; $header = false; // Iterate through returned results while ($row = mssql_fetch_array($data)) { // Build the table header if (!$header) { echo '<thead>'; echo '<tr>'; for ($i = 1; ($i + 1) <= mssql_num_fields($data); ++$i) { echo '<td>' . ucfirst($row[$i]) . '</td>'; } echo '</tr>'; echo '</thead>'; echo '<tbody>'; $header = true; } // Build the row echo '<tr>'; foreach($row as $value) { echo '<td>' . $value . '</td>'; } echo '</tr>'; } // Close table echo '</tbody>'; echo '</table>'; // Clean up mssql_free_result($data); mssql_close($link); ?> SEE ALSO
mssql_query(3), mssql_fetch_field(3), mssql_num_rows(3). PHP Documentation Group MSSQL_NUM_FIELDS(3)
All times are GMT -4. The time now is 03:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy