Sponsored Content
Top Forums UNIX for Dummies Questions & Answers bash script to parse sequence... Post 302476666 by R0H0N on Thursday 2nd of December 2010 08:05:12 AM
Old 12-02-2010
Instead of greping data from data file, extract length and numreads from list file.
Try below mentioned script.

Code:
listFile="/path/listFile.txt"
dataFile="/path/dataFile.txt"
>outputFile

cat $dataFile | while read line
do
if [ "$line" = ".*contig.*length.*" ] ; then
     header=`echo $line | cut -d" " -f1`
     optLine=`grep $header $listFile`
else
     optLine="$line"
fi
echo "$optLine" >> outputFile
done

Use sed if cut command not works.
R0H0N
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do you parse a variable in a bash script?

I have a script I use on my web server (Apache2). I am changing to Lighttpd and need to make a few changes. This is what I use on my apache server #!/bin/bash # accepts 3 parameters: <domain name> <user name> <XXXXXXXX> # domain name is without www (just domain.com) # username would be... (3 Replies)
Discussion started by: vertical98
3 Replies

2. Shell Programming and Scripting

Need to Parse XML from bash script

I am completely new to bash scripting and now need to write a bash script that would parse a XML file and take out values from specific tags. I tried using xsltproc, xml_grep commands. But the issue is that the XML i am trying to parse is not UTF 8. so those commands are unable to parse my XML's... (4 Replies)
Discussion started by: shivashankar.g
4 Replies

3. Shell Programming and Scripting

Bash Script to read a file and parse each record

Hi Guys, I am new to unix scripting and I am tasked to parse through a CSV file delimited by #. Sample: sample.csv H#A#B#C D#A#B#C T#A#B#C H = Header D = Detail Record T = Tail What I need is to read the file and parse through it to get the columns. I have no idea on how... (8 Replies)
Discussion started by: 3vilwyatt
8 Replies

4. Shell Programming and Scripting

Bash Shell Script to parse file

Raw Results: results|192.168.2|192.168.2.1|general/udp|10287|Security Note|For your information, here is the traceroute from 192.168.2.24 to 192.168.2.1 : \n192.168.2.24\n192.168.2.1\n\n results|192.168.2|192.168.2.1|ssh (22/tcp)|22964|Security Note|An SSH server is running on this port.\n... (2 Replies)
Discussion started by: jroberson
2 Replies

5. Shell Programming and Scripting

Press Any Key script sequence using bash - HELP

hi to all. im a newbie in unix shell scripts. i want to make a simple unix shell script using the bash shell that asks a user to press any key after a series of commands, or an x if he wishes to exit. here's a sample script that i made: #!/usr/bin/bash pause(){ /usr/bin/echo "\t\t Press... (3 Replies)
Discussion started by: booghaw
3 Replies

6. Shell Programming and Scripting

Bash Script for parse input like option and value

I would create a bash script than parse like this: test.sh -p (protocol) -i (address) -d (directory) I need retrive the value after -p for example... understand??? I hope... thanks (6 Replies)
Discussion started by: ionral
6 Replies

7. Shell Programming and Scripting

BASH script to parse XML and generate CSV

Hi All, Hope all you are doing good! Need your help. I have an XML file which needs to be converted CSV file. I am not an expert of awk/sed so your help is highly appreciated!! XML file looks like this: <l:event dateTime="2013-03-13 07:15:54.713" layerName="OSB" processName="ABC"... (2 Replies)
Discussion started by: bhaskar_m
2 Replies

8. Shell Programming and Scripting

Bash script - cygwin (powershell?) pull from GitHub API Parse JSON

All, Have a weird issue where i need to generate a report from GitHub monthly detailing user accounts and the last time they logged in. I'm using a windows box to do this (work issued) and would like to know if anyone has any experience scripting for GitAPI using windows / cygwin / powershell?... (9 Replies)
Discussion started by: ChocoTaco
9 Replies

9. Shell Programming and Scripting

Bash Script to parse Perforce Logs

Hi All, I need to write a bash script that will parse some perforce log files, the log files will contain user login information, the script would need to pare the log, and check who logs in, and if the user is a superadmin, then the script will check the ip address to see which server the... (4 Replies)
Discussion started by: BostonRob
4 Replies

10. Shell Programming and Scripting

Bash functions sequence ?

OK, I know function has to be defined first - in sequence - before it can be used. So the script has to be build "bottoms -up style, if you pardon my expression. I am running into a problem reusing function and breaking the sequence. It would be nice to be able to see the function... (10 Replies)
Discussion started by: annacreek
10 Replies
CHMEM(1)						      General Commands Manual							  CHMEM(1)

NAME
chmem - change memory allocation SYNOPSIS
chmem [+] [-] [=] amount file EXAMPLES
chmem =50000 a.out # Give a.out 50K of stack space chmem -4000 a.out # Reduce the stack space by 4000 bytes chmem +1000 file1 # Increase each stack by 1000 bytes DESCRIPTION
When a program is loaded into memory, it is allocated enough memory for the text and data+bss segments, plus an area for the stack. Data segment growth using malloc , brk , or sbrk eats up stack space from the low end. The amount of stack space to allocate is derived from a field in the executable program's file header. If the combined stack and data segment growth exceeds the stack space allocated, the pro- gram will be terminated. It is therefore important to set the amount of stack space carefully. If too little is provided, the program may crash. If too much is provided, memory will be wasted, and fewer programs will be able to fit in memory and run simultaneously. MINIX does not swap, so that when memory is full, subsequent attempts to fork will fail. The compiler sets the stack space to the largest possible value (for the Intel CPUs, 64K - text - data). For many programs, this value is far too large. Nonrecursive programs that do not call brk , sbrk , or malloc , and do not have any local arrays usually do not need more than 8K of stack space. The chmem command changes the value of the header field that determines the stack allocation, and thus indirectly the total memory required to run the program. The = option sets the stack size to a specific value; the + and - options increment and decrement the current value by the indicated amount. The old and new stack sizes are printed. SEE ALSO
install(1), brk(2). CHMEM(1)
All times are GMT -4. The time now is 09:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy