Sponsored Content
Full Discussion: Extract from txt file
Top Forums Shell Programming and Scripting Extract from txt file Post 302326037 by summer_cherry on Wednesday 17th of June 2009 01:30:06 AM
Old 06-17-2009
Code:
while(<DATA>){
	next if /^#/;
	my @tmp=split(/\s+/,$_);
	push @arr1, $tmp[0];
	push @arr2, $tmp[1];
}
print join "|", @arr1;
print "\n";
print join "|", @arr2;
__DATA__
#command program
abc defmt 
exp refmt
#another command line
bbb defmt
ccc defmt

 

10 More Discussions You Might Find Interesting

1. Programming

c file to extract real value from a txt file

Hello Friends,, I m really a new bee to C programms , please help me with a code.. I found some theads here similar to this but Not able to solve what exactly I want.. suppose I ve txt file as below. abc.txt 12 23 10 11 131 159 12.2 13.8 Then I want to... (7 Replies)
Discussion started by: user_prady
7 Replies

2. UNIX for Dummies Questions & Answers

Binary txt file received when i use uuencode to send txt file as attachment

Hi, I have already read a lot of posts on sending attachments in unix...but none of them were of help for my problem...so here goes.. i wanna attach a text file and send to a mail id..used the following code : uuencode "$File1" "$File1" ;|mail -s "$Mail_sub" abc@abc.com it works... (2 Replies)
Discussion started by: ash22
2 Replies

3. Shell Programming and Scripting

Extract content from several txt-files

Hi! Im trying to write a script in ksh that creates a single txt-file from specific content in several other txt-files. From these files I want to extract all text after 'WORD' and before '=', regardless of number of lines and other content. I have tried cat and guess I need... (7 Replies)
Discussion started by: larsu
7 Replies

4. Shell Programming and Scripting

extract words from txt using perl

Hi, i will deal with txt file and i want to use perl to extract number of words from this txt ex :if the txt file is a story which contains person names and iwant to extract these names and there is something else that these names which i want perl to extract must match the words (person names) ... (2 Replies)
Discussion started by: eng_shimaa
2 Replies

5. UNIX for Dummies Questions & Answers

Extract numbers from .txt file

I need to extract all the p-value numbers and the rho numbers from a .txt file and write them as coma separated values in a new file. Ideally I would get two files in the end, one for p- values and one for rho. Any suggestions? I appreciate your help!!! The .txt file looks essentially like this... (5 Replies)
Discussion started by: eggali
5 Replies

6. Shell Programming and Scripting

Command to extract all columns except the last few from a txt file

hello, i have publicly available txt file with little less than 300000 rows. i want to extract from column 1 to column 218 and save it in another text file. i use the cut command but the file is saved with multiple rows from the source file onto a single row in the destination. basically it is... (6 Replies)
Discussion started by: madrazzii
6 Replies

7. Shell Programming and Scripting

Script extract text from txt file with grep

All, I require a script that grabs some text from the gitHub API and will grep (or other function) for a string a characters that starts with (") quotes followed by two letters, may contain a pipe |, and ending with ) . What i have so far is below but it's not returning anything. ... (4 Replies)
Discussion started by: ChocoTaco
4 Replies

8. Shell Programming and Scripting

Extract the filename and write to .txt

I'm new to this forum and also to UNIX scripting. I need a command to extract the filename from the path and write to .txt file. Thanks in advance for your guidance. (23 Replies)
Discussion started by: Ram Kumar_BE
23 Replies

9. Shell Programming and Scripting

Extract information from txt file

Hello! I need help :) I have a file like this: AA BC FG RF TT GH DD FF HH (a few number of rows and three columns) and I want to put the letters of each column in a variable step by step in order to give them as input in another script. So I would like to obtain: for the 1° loop:... (11 Replies)
Discussion started by: edekP
11 Replies

10. UNIX for Beginners Questions & Answers

To extract values after the maximum value in a txt file

Hello, I'm new to scripting and I need to write a bash script. Here is example of file on which I'm working: 0.3092381 0.3262799 0.3425480 0.3578379 0.3719490 0.3846908 0.3958855 0.4053738 0.4130160 0.4186991 0.4223357 ... (1 Reply)
Discussion started by: jeo_fb
1 Replies
MALLOC(3F)																MALLOC(3F)

NAME
malloc, free, falloc - memory allocator SYNOPSIS
subroutine malloc (size, addr) integer size, addr subroutine free (addr) integer addr subroutine falloc (nelem, elsize, clean, basevec, addr, offset) integer nelem, elsize, clean, addr, offset DESCRIPTION
Malloc, falloc and free provide a general-purpose memory allocation package. Malloc returns in addr the address of a block of at least size bytes beginning on an even-byte boundary. Falloc allocates space for an array of nelem elements of size elsize and returns the address of the block in addr. It zeros the block if clean is 1. It returns in offset an index such that the storage may be addressed as basevec(offset+1) ... basevec(offset+nelem). Falloc gets extra bytes so that after address arithmetic, all the objects so addressed are within the block. The argument to free is the address of a block previously allocated by malloc or falloc; this space is made available for further alloca- tion, but its contents are left undisturbed. To free blocks allocated by falloc, use addr in calls to free, do not use basevec(offset+1). Needless to say, grave disorder will result if the space assigned by mallocorfalloc is overrun or if some random number is handed to free. DIAGNOSTICS
Malloc and falloc set addr to 0 if there is no available memory or if the arena has been detectably corrupted by storing outside the bounds of a block. The following example shows how to obtain memory and use it within a subprogram: integer addr, work(1), offset ... call falloc ( n, 4, 0, work, addr, offset ) do 10 i = 1, n work(offset+i) = ... 10 continue The next example reads in dimension information, allocates space for two arrays and two vectors, and calls subroutine doit to do the compu- tations: integer addr, dummy(1), offs read *, k, l, m indm1 = 1 indm2 = indm1 + k*l indm3 = indm2 + l*m indsym = indm3 + k*m lsym = n*(n+1)/2 indv = indsym + lsym indtot = indv + m call falloc ( indtot, 4, 0, dummy, addr, offs ) call doit( dummy(indm1+offs), dummy(indm2+offs), . dummy(indm3+offs), dummy(indsym+offs), . dummy(indv +offs), m, n, lsym ) end subroutine doit( arr1, arr2, arr3, vsym, vec, m, n, lsym ) real arr1(k,l), arr2(l,m), arr3(k,m), vsym(lsym), v2(m) ... FILES
/usr/lib/libU77.a SEE ALSO
malloc(3) 4.3 Berkeley Distribution May 15, 1985 MALLOC(3F)
All times are GMT -4. The time now is 01:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy