Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to cut data block from .txt file in shell scripting Post 302310052 by pank29 on Thursday 23rd of April 2009 02:41:48 PM
Old 04-23-2009
I used this also...

x=`grep -n "Cluster Resource Groups ===" test123.txt | cut -d ":" -f1`
y=`grep -n "Cluster Resource ===" test123.txt | cut -d ":" -f1`
a=`echo ${x} + 1 | bc`
b=`echo ${y} -1 | bc`
echo $x $y $a $b
sed -ne "${a},${b}p" test123.txt

But its giving me this error -->
syntax error on line 1, -1
sed: Function syntax error on line 1, ,-1p cannot be parsed.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell scripting to extract data from file

Hi, i want to fetch the data from the alert log file, for a particular time interval. Example : Alert log content : Thu Mar 18 08:47:36 2010 Completed: alter database open Thu Mar 18 19:13:38 2010 MMNL absent for 6390 secs; Foregrounds taking over Fri Mar 19 08:30:52 2010... (1 Reply)
Discussion started by: Pinki018
1 Replies

2. Shell Programming and Scripting

Extracting data from file-shell scripting--please help

hello friends, my file is like 123 |asd|asd|asd 123_1|awd|asw|asw 121 |wer|qwe|wee 124 |weq|qwe|iop 1_23 |bla|blh|bha 145 |ghj|jkl|ghj 146 |qwe|qwe|wer 154 |asd|wer|qw_e 134_5|qwe|wer|qw_e is their any solution to retrive only those lines which are having only 3 numerical letters... (20 Replies)
Discussion started by: PankajChawla
20 Replies

3. Shell Programming and Scripting

Replace data of a file with data from another file using shell scripting.

Dears, I'm new to shell scripting and i was wondering if you can help me with following matter. I have a file containing 400,000 records. The file contains two columns like: 00611291,0270404000005453 25262597,1580401000016155 25779812,1700403000001786 00388934,1200408000000880... (1 Reply)
Discussion started by: paniklas
1 Replies

4. Shell Programming and Scripting

Shell scripting- cut the location of the file

Hi, I need to just cut the location of file and give it as input to the other command. For example: ct lsview | grep kavya- * kavya-telecom-view /first/nso01/disk2/views/kavya-telecom-view.vws I need only the location like /first/nso01/disk2/views/kavya-telecom-view.vws.How to cut that... (4 Replies)
Discussion started by: kkalyan
4 Replies

5. Shell Programming and Scripting

How to extract data from xml file using shell scripting?

Hi evry1, This is my 1st post in this forum.Pls help me I want to extract some data froma xml file which has 2000 lines using shell scripting. Actually my xml file has some "audio and video codes" which i need to arrange in a column wise format after extracting it using shell scripting.I... (4 Replies)
Discussion started by: arun_kohan
4 Replies

6. Shell Programming and Scripting

How to extract data from XML file using shell scripting?

Hi , I have input file as XML. following are input data #complex.xml Code: <?xml version="1.0" encoding="UTF-8"?><TEST_doc xmlns="http://www.w3.org/2001/XMLSchema-instance"> <ENTRY uid="123456"> <protein> <name>PROT001</name> <organism>Human</organism> ... (1 Reply)
Discussion started by: arun_kohan
1 Replies

7. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

8. Programming

Writing a UNIX shell script to call a C function and redirecting data to a .txt file

Hi, I am complete new to C programming and shell scripting. I just wrote a simple C code to calculate integral using trapezoid rule. I am prompting user to pass me No. of equally spaced points , N , upper and lower limit. My code looks as follows so far: #include<stdio.h> #include<string.h>... (2 Replies)
Discussion started by: bjhjh
2 Replies

9. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

10. Shell Programming and Scripting

How to get the shell script to read the .txt file as an input/data?

i have written my shell script in notepad however i am struggling to pass the data file to be read to the script the data file is of .txt format. My target is to run the shell script from the terminal and pass 3 arguments e.g. polg@DESKTOP-BVPDC5C:~/CS1420/coursework$ bash valsplit.sh input.txt... (11 Replies)
Discussion started by: Gurdza32
11 Replies
PG_SEND_QUERY(3)														  PG_SEND_QUERY(3)

pg_send_query - Sends asynchronous query

SYNOPSIS
bool pg_send_query (resource $connection, string $query) DESCRIPTION
pg_send_query(3) sends a query or queries asynchronously to the $connection. Unlike pg_query(3), it can send multiple queries at once to PostgreSQL and get the results one by one using pg_get_result(3). Script execution is not blocked while the queries are executing. Use pg_connection_busy(3) to check if the connection is busy (i.e. the query is executing). Queries may be cancelled using pg_cancel_query(3). Although the user can send multiple queries at once, multiple queries cannot be sent over a busy connection. If a query is sent while the connection is busy, it waits until the last query is finished and discards all its results. PARAMETERS
o $connection - PostgreSQL database connection resource. o $query - The SQL statement or statements to be executed. Data inside the query should be properly escaped. RETURN VALUES
Returns TRUE on success or FALSE on failure. Use pg_get_result(3) to determine the query result. EXAMPLES
Example #1 pg_send_query(3) example <?php $dbconn = pg_connect("dbname=publisher") or die("Could not connect"); if (!pg_connection_busy($dbconn)) { pg_send_query($dbconn, "select * from authors; select count(*) from authors;"); } $res1 = pg_get_result($dbconn); echo "First call to pg_get_result(): $res1 "; $rows1 = pg_num_rows($res1); echo "$res1 has $rows1 records "; $res2 = pg_get_result($dbconn); echo "Second call to pg_get_result(): $res2 "; $rows2 = pg_num_rows($res2); echo "$res2 has $rows2 records "; ?> The above example will output: First call to pg_get_result(): Resource id #3 Resource id #3 has 3 records Second call to pg_get_result(): Resource id #4 Resource id #4 has 1 records SEE ALSO
pg_query(3), pg_cancel_query(3), pg_get_result(3), pg_connection_busy(3). PHP Documentation Group PG_SEND_QUERY(3)
All times are GMT -4. The time now is 09:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy