Sponsored Content
Top Forums Shell Programming and Scripting append a record at the end of a file Post 302236268 by jim mcnamara on Monday 15th of September 2008 07:15:17 AM
Old 09-15-2008
one way
Code:
rec="1234 last record"
echo "$rec" >> myfile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

echo, append to end of file

I need the line printed with echo to append to eof of to exactly line, am i able to do that? i mean echo "sysctl -w lalala=1" > to end of file /etc/sysctl.conf or to the 21st line, if the line exist, open new line and insert text there. Thx.maybe i'm in wrong topic but anyway... (2 Replies)
Discussion started by: hachik
2 Replies

2. Shell Programming and Scripting

to append few chars at the end of a file

hi i want to open a file at runtime append few chars at the end of each line all these i want to have done automatically how to do it (2 Replies)
Discussion started by: trichyselva
2 Replies

3. Shell Programming and Scripting

Append text at end of the first line in a file

Hi I need to append some text @ end of the first line in a file. like myfile.txt list = a,b,c list.a=some.. I give the arg "d" . now it append at end of first line list=a,b,c,d list.a=some... Please help me out this (7 Replies)
Discussion started by: catgovind
7 Replies

4. UNIX for Dummies Questions & Answers

How to append a semcolon to every record in a file?

Hi, If a file is like 123 456 894 568 234 and the desired o/p is "123" "456" "894" -- -- How can it be done? (2 Replies)
Discussion started by: er_ashu
2 Replies

5. Shell Programming and Scripting

Append newline at the file end

Hi All, Is there any way to append a newline character at the end of a file(coma-separated file), through shell script? I need to check whether newline character exists at the end of a file, if it does not then append it. Regards, Krishna (1 Reply)
Discussion started by: KrishnaSaran
1 Replies

6. Shell Programming and Scripting

append a character at end of each line of a file

Hi, i want to append a character '|' at end of each line of a file abc.txt. for example if the file abc.txt conatins: a|b|c 1|2|33 w|2|11 i want result file xyz.txt a|b|c| 1|2|33| w|2|11| I know this is simple but sumhow i am not able to reach end of line. its urgent, thanks for... (4 Replies)
Discussion started by: muaz
4 Replies

7. Shell Programming and Scripting

Append a string at the end of every line in a file

Hi Friends, I have a file with many lines as shown below. /START SAMPLE LINE/ M:\mmarimut_v6.4.0_pit_01\java\build.xml@@\main\v6.4.0_pit_a M:\mmarimut_v6.4.0_pit_01\port\Post.java@@\main\v6.4.0_pit_a M:\mmarimut_v6.4.0_pit_01\switchview\View.java@@\main\v6.4.0_pit_a /END SAMPLE LINE/ I... (1 Reply)
Discussion started by: nmattam
1 Replies

8. Shell Programming and Scripting

append | to the end of each data in a file

I have a file which has data in the below format: 7810902|6783014102| || |0| |0| |0| |0|||||T|04/13/2006||9423|7421||100|2006-04-13 16:50:28|||2006-04-13 16:50:28|n|51|-1||214 1089929|||||NewSpCreateAction request successful. Activity ID = <826528>||||100|n|2006-04-13 16:50:27|2006-04-13... (3 Replies)
Discussion started by: ankianand88
3 Replies

9. Shell Programming and Scripting

Replace string and append Indicator to end of record in Linux

Hi All, Could you please help me to achieve below solution. I have a FILE1.txt as below.TEXAS CALIFORNIA TEXAS DALLAS CALIFORNIA CALIFORNIA DALLAS DALLAS TEXAS TEXAS DALLAS NEW YORK NEW YORk FILE2.txt as below.TEXAS,TX DALLAS,DA Now I need to compare the string in FILE2.txt... (6 Replies)
Discussion started by: ureddy
6 Replies

10. Shell Programming and Scripting

Help with awk script to append seq num at end of record

Hi Unix forum. I have the following requirement to add a sequence value to each record in a file but only if it meets certain conditions. Field value in pos. 1 and 2 must be '0B' or 'OA' else leave as is. Sequence value must be preserved for each OB and OA pair. Data Before: 123 456... (5 Replies)
Discussion started by: pchang
5 Replies
YAZ_RECORD(3)								 1							     YAZ_RECORD(3)

yaz_record - Returns a record

SYNOPSIS
string yaz_record (resource $id, int $pos, string $type) DESCRIPTION
The yaz_record(3) function inspects a record in the current result set at the position specified by parameter $pos. PARAMETERS
o $id - The connection resource returned by yaz_connect(3). o $pos - The record position. Records positions in a result set are numbered 1, 2, ... $hits where $hits is the count returned by yaz_hits(3). o $type - The $type specifies the form of the returned record. Note It is the application which is responsible for actually ensuring that the records are returned from the Z39.50/SRW server in the proper format. The type given only specifies a conversion to take place on the client side (in PHP/YAZ). Besides conversion of the transfer record to a string/array, PHP/YAZ it is also possible to perform a character set conversion of the record. Especially for USMARC/MARC21 that is recommended since these are typically returned in the character set MARC-8 that is not supported by browsers, etc. To specify a conversion, add ; charset= from , to where from is the original character set of the record and to is the resulting character set (as seen by PHP). o string - The record is returned as a string for simple display. In this mode, all MARC records are converted to a line-by- line format since ISO2709 is hardly readable. XML records and SUTRS are returned in their original format. GRS-1 are returned in a (ugly) line-by-line format. This format is suitable if records are to be displayed in a quick way - for debugging - or because it is not feasible to perform proper display. o xml - The record is returned as an XML string if possible. In this mode, all MARC records are converted to MARCXML. XML records and SUTRS are returned in their original format. GRS-1 is not supported. This format is similar to $string except that MARC records are converted to MARCXML This format is suitable if records are processed by an XML parser or XSLT pro- cessor afterwards. o raw - The record is returned as a string in its original form. This type is suitable for MARC, XML and SUTRS. It does not work for GRS-1. MARC records are returned as a ISO2709 string. XML and SUTRS are returned as strings. o syntax - The syntax of the record is returned as a string, i.e. USmarc, GRS-1, XML, etc. o database - The name of database associated with record at the position is returned as a string. o array - The record is returned as an array that reflects the GRS-1 structure. This type is suitable for MARC and GRS-1. XML, SUTRS are not supported and if the actual record is XML or SUTRS an empty string will be returned. The array returned consists of a list corresponding to each leaf/internal node of GRS-1. Each list item consists a sub list with first element path and data (if data is available). The path which is a string holds a list of each tree component (of the structured GRS-1 record) from root to leaf. Each component is a tag type, tag value pair of the form ( type , value String tags nor- mally has a corresponding tag type 3. MARC can also be returned as an array (they are converted to GRS-1 internally). RETURN VALUES
Returns the record at position $pos or an empty string if no record exists at the given position. If no database record exists at the given position an empty string is returned. EXAMPLES
Example #1 Array for GRS-1 record Consider this GRS-1 record: (4,52)Robert M. Pirsig (4,70) (4,90) (2,7)Transworld Publishers, ltd. Robert M. Pirsig. Second element at root level (4,70) has a subtree with a single element (4,90). (4,90) has yet another sub tree (2,7) with data Transworld Publishers, ltd.. If this record is present at position $p, then <?php $ar = yaz_record($id, $p, "array"); print_r($ar); ?> Array ( [0] => Array ( [0] => (4,52) [1] => Robert M. Pirsig ) [1] => Array ( [0] => (4,70) ) [2] => Array ( [0] => (4,70)(4,90) ) [3] => Array ( [0] => (4,70)(4,90)(2,7) [1] => Transworld Publishers, ltd. ) ) Example #2 Working with MARCXML The following PHP snippet returns a MARC21/USMARC record as MARCXML. The original record is returned in marc-8 (unknown to most XML parsers), so we convert it to UTF-8 (which all XML parsers must support). <?php $rec = yaz_record($id, $p, "xml; charset=marc-8,utf-8"); ?> The record $rec can be processed with the Sablotron XSLT processor as follows: <?php $xslfile = 'display.xsl'; $processor = xslt_create(); $parms = array('/_xml' => $rec); $res = xslt_process($processor, 'arg:/_xml', $xslfile, NULL, $parms); xslt_free($processor); $res = preg_replace("'</?html[^>]*>'", '', $res); echo $res; ?> For PHP 5 the XSL extension must be used instead of Sablotron XSLT. PHP Documentation Group YAZ_RECORD(3)
All times are GMT -4. The time now is 08:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy