Fedora :: Text File Manipulation With Standard Commands In BASH - Remove The Stock Code

Oct 10, 2009

I need to do some text file manipulation which I think should be done with standard commands in BASH. I'm looking at comma seperated text files (stock market data). It comes in the form of date, stock code, open, high, low, close, volume. What I need to do first is move all data with same stock code sequentially into individual files.

While doing this since the stock code will now be the file name I need to remove the stock code. Next I need to filter out overlapping data from different files with the same date. ie. where two files contain the same date on the one line only one line will be added to the combined file. I think there must be a tutorial out there for basic text manipulation like this, I just haven't found it yet.

View 11 Replies


ADVERTISEMENT

Programming :: Text Manipulation With Bash For Snort Alert

Nov 26, 2010

I have a little problem about string in Snort alerting. I understood about Snort alerting saved in /var/log/snort/alert and Snort will add a new entry if there was a attack from anywhere. Then here's my problem. Because it has a lot of file on it, all I want to do is parse that string in snort alert then make into simply log files with it. I'm getting confused with Snort alert and parse that file.

Here's the simple algorithm; Snort get the alert <- parse the alert with my parameter which I've configured with bash (ip address, dest, kind of attack and time) <- then sent that parse alert into new text (let's called snortsent.txt) <- after ten alerts then clear the text then waiting again until the Snort alert go on -> back to snort alert. Here's the sample of my snort alert: (/var/log/snort/alert)

[Code]....

View 16 Replies View Related

Programming :: Bash - Reading Csv Delimited File To Array And For Further Manipulation?

Jan 6, 2010

I am trying to do this:

1. Read csv delimited file line1 and store all values in array

2. Use the values stored in the array and replace values in other text file with them

3. read line2 in the cvs file and repeat the process

4. Do above for all lines in the cvs file

for example:

file1.cvs content:

text1,text2,text3,"text 4"
a1,a2,3,"a 4"

file.txt content:

some text $array1$ some text
some text $array2$ some text

1. read line 1 - text1,text2,text3,"text 4" put each value in array X[] lines that contain spaces in cvs will have double quotes

2. read x[1] and replace value $array1$ (in file.txt) with x[1]read x[2] and replace value $array2$ (in file.txt) with x[2] and so on

Can above be accomplished in BASH and how?

View 1 Replies View Related

Programming :: Can Bash Commands Be Converted To Assembly Like C Source Code?

Nov 30, 2010

I have read where C is first converted to Assembly before its final compilation to binary. Is there a way to do this with Bash commands? I would like the understanding that Assembly allows to Bash somehow.

View 14 Replies View Related

Fedora :: Zenity - Bash: [/code]: No Such File Or Directory

Apr 9, 2010

Awhile back, PabloTwo pointed me to zenity as a way to create bash scripts with changeable parameters. That thread is here, for anyone interested in reading about it: [URL] Anyway, my problem is that I'm trying to capture input that contains double-dashes ("--") but zenity (or maybe or it's bash???) complains with the following error message:

"This option is not available. for all possible usages.
bash: [/code]: No such file or directory"

Here's an example of what I'm doing:

Code:

# Select the time of day
Flytime=`zenity --list --text="Select the Time" --radiolist --height=300 --width=300 --hide-column=2 --column="Select" --column="Code" --column="Time of Day"
"" "--timeofday=real" "Local Time"

[code]....

What I want to accomplish is for the variable $Flytime to contain either "--timeofday=real" or "--timeofday=dawn" (without the quotes) depending upon which radio button is selected. I have tried escaping "--timeofday" (e.g. "--timeofday" and even "--timeofday") but that's not working.

View 3 Replies View Related

Programming :: Remove Lines In A Text File Based On Another Text File?

Jan 28, 2009

I have a text file called file1.txt containing many lines eg.

line1
line2
line3
line4
line5
line6

Then i have another text file called file2.txt contains

3
5
6

Is there a command to remove the lines in file1.txt based on the keywords in file2.txt? note: It should remove line3,line5,line6 based on 3,5,6

View 10 Replies View Related

General :: Convert A Large Number Of File Types From None Standard To Text?

Sep 28, 2009

I have on my windows machine several hundred files that are a format of .nc .ncs for a CNC machine. I need to convert them to txt which is something as easy as opening in notepad and then saving as .txt but there are so many that this kind of action would take way too long.

The reason I am writing the linuxquestions is because I would feel more comfortable in loading a live CD and using some sort of terminal command to do this than I would to download one of the many "freeware" type programs I have found for windows (even more so since I have had a root kit before and had to start all the way over to get rid of it).

I need to know:

1. Is this possible to do with the terminal without super advanced knowledge.

2. Can one please point me in the right direction; something to read or an example

View 2 Replies View Related

Fedora :: Write A Bash Script That Will Create A New Text File?

Oct 22, 2009

trying to learn how to write a bash script that will create a new text file named jimbola in my home directory. The file will need to be able to have the first and last name of Jim Bola included in it.

View 4 Replies View Related

Fedora :: Install / Remove Packages Written On A Text File?

Sep 9, 2010

I use the show-leaves yum plugin, and sometimes I use that info to remove some unnecessary packages. But that list can be long, so I write them on a text file.

1) Instead of removing packages one by one is there a way to remove all packages written in that text file?

2) Why isn't the output of the show-leaves plugin compatible with the output of "package-cleanup --leaves"?

View 1 Replies View Related

Programming :: Bash - Remove From Text Table?

Nov 7, 2010

i have a table in a text file. How can i remove from that table for example "SLS= " if the value is empty? Is it possible to do it in bash awk or sed? [URL]

10.25 SLS=* G.V.=* BBU=122 G.V.=14
10.28 SLS=196 G.V.=198 BBU=* G.V.=*
10.08 U.T.=* I.M=--
10.15 U.T.=-0.522 I.M=*

View 1 Replies View Related

Ubuntu :: Add / Remove Bits Of Text From A Text File

Dec 6, 2010

I am looking for a way to keep a log and make if then statements if a line exitsts in the log. I also am looking for a way to make a simple loop, like goto line number, and I also am wondering how to add/remove bits of text from a text file (plugins line in server.properties)

View 5 Replies View Related

General :: Text Manipulation Using Sed - Convert The Characters

May 7, 2010

I have a number of text files (26 per database x 100+ databases) which need 'correcting' in order to import into postgresql. I think that I have identified all the problem characters and I need to automate the process as much as possible. I have a script to convert the characters and I do them one by one (not effecient but easier to understand).

[Code].....

View 2 Replies View Related

Debian :: Image Manipulation In BASH?

Nov 7, 2010

I would like the ability to manipulate a jpg (bmp, gif and raw would be nice as well) while in BASH. To be more specific, I would like to either add a water mark or a little section as a footer on the bottom of an image.

I will be using this as part of a shell script to alter files in a directory on my webserver.

View 2 Replies View Related

Ubuntu :: Text Manipulation - Regex - Pattern Matching?

Jul 12, 2010

Are there some good tutorials or reference materials on how do pattern matching and text manipulation in Linux?I have a few simple tasks I'd like taken care of...like formatting numbers in file names, stripping some text from directory names, etc

View 2 Replies View Related

Ubuntu :: Stock Ticker Applet Or Good Stock Program For Natty 11.04?

Apr 28, 2011

I upgrading to natty 11.04 and lost all my gnome applets. Is there any good stock programs that work with natty and unity? I liked the invest applet on top bar in maverick 10.10. A standalone program to track stocks would be good also if no applet option is available.

View 3 Replies View Related

Ubuntu :: Image Manipulation In Bash Scripting?

Jul 5, 2010

I have a bash script that inserts some text onto every image at a certain place within a directory.

Heres what I have (from a German friend who appears online once in a blue moon), this is the line that resizes to a maximum of 800 either width or height and puts in the text 'text goes here'.

convert ${bild} -resize "800x800>" -strip -family Arial -pointsize 16 -draw "gravity southeast fill rgba(255,0,0, 1.0) text 10,10 'text goes here'" ${dstdir}/${bild}

Now, I would like to know how to place a PNG image (a watermark, so to speak) over all images within a directory in a certain place, so how would I go about modifying this line to place an image instead of the text?

View 9 Replies View Related

General :: Column Manipulation In Bash Script

Mar 19, 2010

I have a text file and I need to replace the 3rd column of that file from row 3 to the end of the file with a column which I have stored in the different text file. For e.g the original file is like given below:

a.txt nobla 6 gadf 72.500 1.600 1.800 .850 5.250 8.540
A# rad ang ht prf bk sd dia type blade
1 0.3081 9.00 1.9235 -17.50 18.00 -3.00 0.6250 1613 1
2 0.6509 194.00 2.0316 -17.50 18.00 -3.00 0.6250 1613 4
3 1.0128 8.00 2.1457 -17.50 18.00 -3.00 0.6250 1616 1
4 1.3748 192.00 2.2598 -17.50 18.00 -3.00 0.6250 1616 4
5 1.6986 7.00 2.3619 -17.50 18.00 -3.00 0.6250 1616 1
6 1.9347 120.00 2.4364 -17.51 18.00 -3.00 0.6250 1616 5
7 2.1327 190.00 2.4988 -17.34 18.00 -3.00 0.6250 1616 4

So lets say I wanna replace column 3 from row 3 to row 7 with a data from another file which is given below:
54.00
239.00
53.00
237.00
52.00
165.00
235.0

So the final output file should be like this:
a.txt nobla 6 gadf 72.500 1.600 1.800 .850 5.250 8.540
A# rad ang ht prf bk sd dia type blade
1 0.3081 54.00 1.9235 -17.50 18.00 -3.00 0.6250 1613 1
2 0.6509 239.00 2.0316 -17.50 18.00 -3.00 0.6250 1613 4
3 1.0128 53.00 2.1457 -17.50 18.00 -3.00 0.6250 1616 1
4 1.3748 237.00 2.2598 -17.50 18.00 -3.00 0.6250 1616 4
5 1.6986 52.00 2.3619 -17.50 18.00 -3.00 0.6250 1616 1
6 1.9347 165.00 2.4364 -17.51 18.00 -3.00 0.6250 1616 5
7 2.1327 235.00 2.4988 -17.34 18.00 -3.00 0.6250 1616 4

And I will post the code whatever i have tried soon. I started with awk and cut commands..but never got it to work and also tried PASTE command too.

View 3 Replies View Related

General :: Text Manipulation Find / Replace Variable Efficiency?

Aug 27, 2010

What I have works, but wondering what is the 'right' way to replace the digits with the letters given in this loop? somehow use a case or multiple sed? i thought of a multiple sed or a case but couldn't get it to work

Code:

# ...
bcv=$(echo $line | awk -F" " '{ print $1 }' | sed 's/1/q/g;s/2/w/g;s/3/e/g') # and so on

Code:

while read line
do
bcv=$(echo $line | awk -F" " '{ print $1 }')
if [ $bcv == "" ]

[code].....

View 12 Replies View Related

General :: Commands To Save Md5sum Of Files In A Folder Into A Text File?

Sep 14, 2010

I've found these commands in [URL]:

Quote:

find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/boot.cat | sudo tee md5sum.txt

But I don't understand these commands, even after reading their manuals.

View 4 Replies View Related

General :: Commands To Remove Particular Few Lines In History File?

Jun 16, 2010

Is there any commands or scripts to remove only selected line in the history file.

View 1 Replies View Related

General :: Copy Code From Text File To Command Prompt?

Dec 2, 2010

First I hope to undrestand my English word because Iam Arabic girl and not so good in English...

my problem is:

I wrote code in .c file and I run that code on the prompt command, its ture but I want after the out put copy the code on the command by some statment in the code , how can I do that?

View 3 Replies View Related

General :: Write A C Code To Ping IP Addresses Which Are Read From A Text File?

Aug 3, 2010

i need to write a c code to ping IP addresses which are read from a text file and need to log the response time in another text file.

View 4 Replies View Related

Software :: Check The Contents Of A Text File For A Specific String And Remove It From The File From The Command Prompt?

Oct 14, 2010

I want to be able to check the contents of a text file for a specific string and remove it from the file from the command prompt. I would basically be searching through a number of files and if a specific string is found I would like it removed automatically. pretty much a find and replace, were the replace is nothing. any one got any ideas on how you would do this. I already have the search part sorted just need to be able to remove the string I don't want from the multiple files.

View 4 Replies View Related

Programming :: Bash-code To Rename Files Based On Config File

Apr 12, 2010

I'm writing a bash shell script that among various other things will traverse through a directory with hundreds of files and rename those who match a pattern found in a config file. It's expected that only about one in ten files will actually match, and those who don't, will simply just be ignored for this purpose.

This should for instance cause the file "dBase program file December 1987.prg" to be renamed "Clipper source code December 1987.prg", and conversely "C++ source August 1996.cpp" to be renamed "C source code August 1996.cpp" etc.A sample file such as "Random Data File.dat" should not be renamed here since it's not mentioned in the config file..What is the quickest, most elegant way to do this in bash?I am thinking of using bash's built-in regex matching combined with the /bin/rename utility, but don't quite know how to get started to catch this..I guess there are plenty ways of doing this in perl and elsewhere as well, but since this has to integrate into a pre-existing bash script, that's what I'm looking for.Anyone out there with a spare moment to offer a hint in the right direction?

View 14 Replies View Related

Programming :: Change A Line In A File Code - Sed Special Characters Bash Script

Jan 26, 2011

I'm having issue when trying to change a line in a file

[Code]....

View 1 Replies View Related

Programming :: Reading From Text File In Bash?

Nov 8, 2010

I need to Read a path of a file witch is written in Text file i used this

Code:

FILENAME=$1
while read line
do
echo $line
done < $FILENAME

it worked and showed me the Line witch was written in my file but now my problem is how am gonna use that line as a path i mean for example if am gonna execute a linux command on that file like dpkg -i /path/to/the/file how am gonna export it from The $Line variable and use it after the command.

View 14 Replies View Related

Ubuntu :: Remove Repeats In Text File

Jul 5, 2011

I have 2 lists of names, they aren't sorted, and may contain repeats.What I would like to do with a bash script is compare the 2 documents and find and remove each repeat name, saving only one of them. Then concatenate the files. Or if it were easier, concatenate first and find and remove all internal repeats.

View 5 Replies View Related

Server :: Remove String In Text File?

Jun 5, 2009

I have a text file which include code...

I mean, this string should be removed from each line and save in another file.

View 9 Replies View Related

Fedora :: Some Bash Script Commands Won't Run

Aug 6, 2009

I'm setting up a scheduler to run some bash script commands but they won't run when I point them to a script file. If I change the cron to call

[code]...

If I run ./writeTimeToLog from the terminal - it, well, writes the time to the log file! I then use

[code]...

to test I can schedule this to run every minute just so I can see it working. the entry was a basic as I could make. It adds the cron successfully but never seems to update the file. Where would an error be put if one occurred.

View 2 Replies View Related

Ubuntu :: Bash Scripting: Making A Text File

Jul 12, 2010

I am tying to write a script that asks for user input and saves it to a text file using awk so example #!/bin/bash read a awk #saves to file

I had a working scripted last night, deleted it by mistake and for the life of me can not remember how i did it.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved