Sponsored Content
Full Discussion: Noob needs script help Grep
Top Forums Shell Programming and Scripting Noob needs script help Grep Post 302330015 by harte on Tuesday 30th of June 2009 03:20:46 AM
Old 06-30-2009
Noob needs script help Grep

Code:
   while read s1 s2; do
grep -i -w $s1 6-29data | tr "[A-Z]" "[a-z]" | sed 's/^[^,]*,//' | sed 's/200906/2009-06-/g' >> $s1.txt ;

cat header > here ;
cat $s1.txt | sort | uniq | tac >> here ;
cat here | uniq > $s1.txt ;

done < list

Wow this almost worked file list has 8000 stock symbols which are updated by grepping the symbol in that days data for all symbols then writing to a text file.

list looks like this only much longer
Code:
wxs
wy
wye
wyn
x
xaa
xcj
xco
xec
xel
xel-a
xel-c
xfb
xfd
xfh
xfl

The problem is this there are stock symbols on nyse and amex with only one symbol for name such as X, Y, C,

here's what the data file 6-29data looked like today only much shorter.
Code:
XIN,20090629,6.8,6.87,6.45,6.46,186300
XJT,20090629,1.26,1.32,1.25,1.27,32600
XKK,20090629,6.59,6.59,6.55,6.57,4700
XKN,20090629,11.16,11.31,10.7,11.31,17300
XKO,20090629,9.81,9.81,9.81,9.81,1000
XL,20090629,10.87,11.75,10.76,11.49,6317400
XL-Y,20090629,19,19.8,19,19.6,7000
XOM,20090629,69.45,70.78,69.13,70.58,24359100
XRM,20090629,1.09,1.16,1.09,1.11,298300
XRX,20090629,6.65,6.71,6.52,6.62,3966800
XTO,20090629,38.5,38.83,37.81,37.98,7603400
XVF,20090629,13.24,13.35,13.24,13.35,5400
XVG,20090629,23.05,23.05,22.32,22.65,1300
Y,20090629,263.42,268.63,262.3,266.69,18500

The problem is this grep -i -w $s1 6-29data
works it finds incidents of one letter symbols like X,Y,C but it also grabs data from the hyphenated symbols like XL-Y ............

Hope this makes sense, sorry wasn't born with the coding gift perhaps you can help Smilie

Last edited by Yogesh Sawant; 06-30-2009 at 04:42 AM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using PHP script with crontab (NOOB)

Hi, I am trying to use a PHP script as a test for a cron job. My crontab is 1 line: 30 * * * * /home/www/inc/crontab.php if I test the file through the browser (ie. http://www.domain.com/inc/crontab.php), the PHP script works -- so there is nothing wrong with the PHP script itself or the... (5 Replies)
Discussion started by: Bobafart
5 Replies

2. Shell Programming and Scripting

noob. need help to create a script.

Hi All. im a noob to scripting. could somone help me with a script please. what i want to do is. 1. run a cmd in the script - qmqtool -s this will give me an output similar to this. Messages in local queue: 790 Messages in remote queue: 306 Messages in todo queue: 23 i then want... (1 Reply)
Discussion started by: aron
1 Replies

3. Shell Programming and Scripting

Why does my script not work? (Noob Alert)

I am a scripting noob and I have tried to search on google, but cannot find the answer as to why this script doesn't work properly. The idea of this script is that it will list all files starting with f in a certain folder, and delete all but the three newest one. I am trying to achieve this by... (4 Replies)
Discussion started by: bronkeydain
4 Replies

4. Shell Programming and Scripting

Noob, script formatting query

Hi all, im new to the forums and i hope im not asking a heavily posted Q but here goes. I use the following script to do a simple calculation, the problem is, the data i receive is in the form of numbers with commas i.e. 1,000,000 This code below wont recognise the commas so i have to remove... (2 Replies)
Discussion started by: benjo
2 Replies

5. UNIX for Dummies Questions & Answers

Linux noob needing help with a script

Hi, Very new to linux but I've just recently setup an ubuntu server. I have 2 broadband connections and would like to have fallback on the server should one of the lines fail. I know what I want it to do, but dont know how to script it. heres the senario; ubuntu server with 2 ethernet... (0 Replies)
Discussion started by: ziggycat
0 Replies

6. Shell Programming and Scripting

Total noob script

Hi i am a total noob at shell scripting. i was wondering if somebody could help me with my script. i want the script to search the dev folder for the burner file because they are different between distrubutions? as i under stand it. this i the script. #!/bin/bash echo "Script för att bränna 360... (4 Replies)
Discussion started by: MatsO
4 Replies

7. UNIX for Dummies Questions & Answers

Is there any way of splitting the script (Noob Here).

I m writing a script to check Server Hardening. The problem is whenever i add new point it grows and it become very tedious to edit the script file. Is there any way of making them separate and call them from one base script? Is it possible to define global variable that can be accessed via... (5 Replies)
Discussion started by: pinga123
5 Replies

8. UNIX for Dummies Questions & Answers

Date check script (noob)

Hello, I've been given the task of checking the date of expiration dates and notify when the date is 30 days away from expiration. As stated in the Title, I'm very new to this, I did a good bit of work over the last two days to only find out I was going down the wrong path. I'm not... (3 Replies)
Discussion started by: drey4184
3 Replies

9. Shell Programming and Scripting

Need help with simple script (noob)

Hi This is my first time attempting a bash script, or any kind of programming. I'm trying to get a clear picture but it helps to work backwards. It would be greatly appreciated if someone could show me what this script would look like... Write a script that displays todays date in... (1 Reply)
Discussion started by: earthicle
1 Replies

10. UNIX for Beginners Questions & Answers

Noob. shell script with prompt?

Hey Guys and Gals, Im a complete Noob to Unix. But recently have started working on a unix system for my PET/CT scanner. My scanner comes with a MOD drive for backup. I would like to back up to USB (its alot cheaper). But the only way to do so is by manually enterin the unix commands. Id like to... (13 Replies)
Discussion started by: TorresGXL
13 Replies
syms(5) 							File Formats Manual							   syms(5)

Name
       syms - MIPS symbol table

Syntax
       #include < sym.h>
       #include < symconst.h>

Description
       Unlike the COFF symbol table, the MIPS symbol table consists of many tables unbundling information.  The symbol table should be viewed as a
       network-style database designed for space and access efficiency.

       The following structures or tables appear in the MIPS symbol table:

       TABLE			CONTENTS

       Symbolic header		Sizes and locations of all other tables

       File descriptors 	Per file locations for other tables

       Procedure descriptors
				Frame information and location of procedure info

       Local symbols		Local type, local variable, and scoping info

       Local strings		String space for local symbols

       Line numbers		Compacted by encoding, contains a line per instruction

       Relative file descriptors
				Indirection for interfile symbol access

       Optimization symbols
				To be defined

       Auxiliary symbols	Variable data type information for each local symbol

       External symbols 	Loader symbols (global text and data)

       External strings 	String space for external symbols

       Dense numbers		Index pairs (file, symbol) for compiler use

       External and local symbols contain the standard concept of a symbol as follows:
       struct
       {
	    long iss; /* index into string space */
	    long value;    /* address, size, etc., depends on sc and st */
	    unsigned  st: 6;	/* symbol type (e.g. local, param, etc.) */
	    unsigned  sc: 5;	/* storage class (e.g. text, bss, etc.) */
	    unsigned  reserved: 1;
	    unsigned  index;	/* index to symbol or auxiliary tables */
       };

See Also
       ldfcn(5)

								       RISC								   syms(5)
All times are GMT -4. The time now is 12:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy