Programming :: Process Each Paragraph In A File Separately?
Jan 4, 2011
I have a script can process input text file and find out 3 values called positive, negative, neutral. Now, I have a new input file which contains some text called 'content' and I need to use the above script to get three value positive, negative, neutral for each of this 'content'. The content is text in many lines and bounded by two tags <content> and </content>
The input file could have this format:
<example>
<input>
<id>abcdef</id>
<content> line1
line 2
[Code].....
Do you think that is possible to write that in Linux ? I have the feeling that using Linux with text finding, replacing much shorter and easier(when I have to write long and complicated code in other languages), so really want to learn how to use it from here.
View 14 Replies
ADVERTISEMENT
Jul 26, 2011
I want to copy below content to a file after line 200.
Alias /A/ "/A/B/C/D/"
<Directory "/E/F/G/H/">
Options Indexes MultiViews
AllowOverride None
[Code]....
Or is it possible if I can copy this content in some other file and insert to the main file.
View 4 Replies
View Related
Sep 23, 2010
I have a simple log file which is very messy and I need it to be neat. The file contains log headers but are all jumbled up together thereforeI need to sort the log files according to the log headers. There are no static number of lines that means that there is no fix number of lines for the each header of the text file. And I am using AWK to sort out the headers.The Log files goes something like this:
Code:
Car LogFile Header
<text>
[code]...
View 1 Replies
View Related
Sep 24, 2010
I have a simple log file which is very messy and I need it to be neat. The file contains log headers but are all jumbled up together therefore I need to sort the log files according to the log headers. There are no static number of lines that means that there is no fix number of lines for the each header of the text file. And I am using AWK to sort out the headers.
The Log files goes something like this:
Code:
Car LogFile Header
<text>
<text>
[Code]....
View 1 Replies
View Related
Jul 9, 2010
I hade created a file with following text entries.
content of fileitems.txt
kdeaccessibility-4.4.92
kdeadmin-4.4.92
kdeartwork-4.4.92
kdebase-4.4.92
How do I read the file one line at a time and so its ready to do something with that line.
View 3 Replies
View Related
Oct 26, 2010
I need to process a log file on an hourly basis but the log only rotates once a day.Basically, I am trying to get the difference between the previous file and the current file based on datetime. ie. The new file's datetime events > previous file's datetime events.The first field in the files is datetime.
Code:
2010-10-27 01:57:32,aaa.bbb.ccc.ddd,host1
2010-10-27 01:57:32,aaa.bbb.ccc.ddd,host2
[code]...
View 4 Replies
View Related
Feb 16, 2010
I am working in HP UNIX. I have one process which is running continuously.There is log file generated for the process. I want to take back up of file without loosing any logs after particular interval of time or say file size increases more that 1GB.
View 3 Replies
View Related
Mar 8, 2011
I need to disable file access (fopen, freopen, open etc) for application which is running under chroot jail and with restrictions (rlimit) via execv. Before that I redirected stdin/out to files within jail. I tried this:
Code:
// Redirect stdin/stdout to files
int fd = open (file_input, O_RDONLY);
if (fd < 0)
fatal_error ("input open failed!");
[Code].....
View 6 Replies
View Related
Nov 9, 2010
I have a shell script to identify whether the process is running or not. If the process is not running, then I execute another script file to run my application. Below is my script and saved this script as monitorprocess.sh Code: #!/bin/bash
result=$(ps -ef | grep -v grep | grep "applicationname.sh" | awk '{print $2}')
echo $result
if [ "$result" == "" ];
[code]...
View 4 Replies
View Related
Mar 31, 2011
Is there any difference in cpu usage for process in init.rc(runs automatic when boot is happened) and manually running process. Will these both have same priority by default...?
View 1 Replies
View Related
Nov 26, 2008
I tried googling but didn't get any answer for this.I have a process called "abc" and it is running with PID "123".I have a putty session opened with PID "999".I am giving kill -TERM 123 from putty session.My process "abc" before dying it should catch the PID of the terminal which provided TERM signal to it.Is there any way to find this out
View 2 Replies
View Related
Nov 11, 2010
I've some file with .sh extensions that runs some softwares.Now,how do I stop running that filesI know we run the command ./start_tomcat.sh to start the apache.Is there any command to stop that file/process or is it just kill the process to stop the process
View 2 Replies
View Related
Jan 8, 2010
one tell me the internal working of kill command. that is how it kills a process internally or from where it picks file to continue its process.
View 3 Replies
View Related
May 22, 2011
I have Open Office 3.2 with Ubuntu 10.04.When I select text-- a word, a few words-- and then click on highlight on the toolbar, it highlights the whole paragraph, rather than just the selected text. This is a new problem for me, before it seemed to be working fine.
I searched online but haven't been able to find anything about this problem. I had tried to install the sun version of Open Office a few months ago, but wasn't able to in the end: [URL] I saw that OpenOffice 3.3 is out, but I would rather not upgrade until Ubuntu puts out the upgrade.
View 9 Replies
View Related
May 26, 2011
I downloaded and burnt the ISO imagw of Fedora 15 onto a CD. I wanted to try Fedora 15 before installing. So, I booted from the CD. However, in the list of Applications, I do not find Libreoffice Suite. Wil I need to download Libreoffice separately after installing Fedora 15?
View 1 Replies
View Related
Sep 17, 2010
In Synergy, is it possible to set up your config so that you have one server and one client, both with dual monitors, but the client machine has its monitors such that one is on the left of the server's left monitor, and the other is on the right of the server's right monitor? For example:
+----------+ +----------+ +----------+ +----------+
| client | | server | | server | | client |
| screen1 | | screen1 | | screen2 | | screen2 |
+----------+ +----------+ +----------+ +----------+
Hopefully my ASCII is good enough to understand. Both machines will be running Linux. If there's a way to do it by messing with xorg configs that would be perfectly acceptable too.
View 2 Replies
View Related
Aug 16, 2010
I am working on a project that sets up packages on the cloud.
For example, If i want to setup Drupal, i need seperate machines to maintain separate tasks, like mysql in one machine(cloud instance/node 1), apache server in another machine(cloud instance/node 2), etc.
So if drupal.rpm has dependencies apache.rpm(has deps too) and mysql.rpm(has deps too)
Is it possible in rpm package manager(yum) to handle such customizations & above requirement?
View 4 Replies
View Related
Nov 9, 2010
I have a shell script to identify whether the process is running or not. If the process is not running, then I execute another script file to run my application. Below is my script and saved this script as monitorprocess.sh
Code:
#!/bin/bash
result=$(ps -ef | grep -v grep | grep "applicationname.sh" | awk '{print $2}')
[code]...
View 14 Replies
View Related
Aug 12, 2010
Is there a task manager in ubuntu or do I have to install it? I am new to ubuntu and still need to customize it.
View 2 Replies
View Related
Mar 10, 2011
I want to kill parent process after "fork()" method. but if I kill parent process with "exit(0)" method, main() thread is terminated as well so child prosess doesn't work anymore. Is there any way to kill only parent process without affecting to child process?
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
[code]....
View 1 Replies
View Related
Sep 14, 2010
I am connected to a network with free traffic inside it and post-paid outer traffic. So I need a way to be able to separately monitor the download traffic from inside and outside the network. All the solutions I`ve found for now offer monitoring of ALL up/down traffic.
So, I want to get separate statistics on these:
1 — 81.89.188.0/23, 217.197.9.0/24
2. — 81.89.186.0/23
3. — 81.89.178.0/23
4. — 81.89.176.0/23
5. — 81.89.180.0/24
9. — 217.197.12.0/24
[Code]...
UPD: I`m connected to the internet through the network`s gate, so all the traffic comes through eth0. I wish to separate traffic incoming from the IPs on top from all other traffic
View 9 Replies
View Related
Dec 7, 2009
Consider the following code:
Code:
int main()
{
int i=0;
pid_t pid;
for(i=0;i<2;i++)
[code]....
I get the following output:
Parent: chid_pid=4356 i=0 parent's pid=4355
This is child 4356 i=0
This is child 4357 i=1
[code]....
I can observe instead of two children(as I expect) processes there are three. This is because child process 4356 creates its own child. Why all the messages of the type "This is child X i=Y" are concentrated one under another? How exactly fork works? Is affected by the fact that I have a dual-core processor?
View 3 Replies
View Related
Sep 28, 2010
i want a process that can operate as both a TCP echo server and a UDP echo server. The process can provide service to many clients at the same time, but involves a single process that does not start up any other threads.
View 3 Replies
View Related
Jan 31, 2011
I tried to get process ID using pidof. It didn't give any error but a blank output at console Code: $ pidof -s instance1
$
But when I use ps -ef, I get the process ID Code: $ ps -ef | grep instance1
root 4174 21661 0 06:52 pts/1 00:00:00 grep instance1
provgw 30220 30219 28 06:46 pts/1 00:01:44 /usr/java/jdk1.6.0_18/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
[Code].....
View 5 Replies
View Related
Jan 11, 2011
I'm programming a software system that consists of multiple processes. It is programmed in C++ under Linux. and they communicate among them using Linux shared memory.
Usually, in software development, is in the final stage when the performance optimization is made. Here I came to a big problem. The software has high performance requirements, but in machines with 4 or 8 CPU cores (usually with more than one CPU), it was only able to use 3 cores, thus wasting 25% of the CPU power in the first ones, and more than 60% in the second ones. After many, many research, and having discarded mutex and lock contention, I found out that the time was being wasted on shmdt/shmat calls (detach and attach to shared memory segments). After some more research, I found out that these CPUs, which usually are AMD Opteron and Intel Xeon, use a memory system called NUMA, which basically means that each processor has its fast, "local memory", and accessing memory from other CPUs is expensive.
After doing some tests, the problem seems to be that the software is designed so that, basically, any process can pass shared memory segments to any other process, and to any thread in them. This seems to kill performance, as process are constantly accessing memory from other processes.
Now, the question is, is there any way to force groups of process to execute in the same CPU?. I don't mean to force them to execute always in the same processor, as I don't care in which one they are executed, but that would do the job. Ideally, there would be a way to tell the kernel: If you schedule this process in one processor, you must also schedule this "brother" process (which is the process with which it communicates through shared memory) in that same processor, so that performance is not penalized.
View 1 Replies
View Related
May 25, 2010
How can I programatically know the status of a process if its PID is known?
View 1 Replies
View Related
Oct 20, 2010
Is there a way to send/receive messages between 2 process using copy_from_user and copy_to_user ? I'm looking for some article, but did not found anything.
View 1 Replies
View Related
May 29, 2010
I'm completely new to scripting and I'm trying to figure out how to write a script that will get a list of all the files in a directorywn through any subdirectories.When I have the list I want to o each file in VI and change the fileformat. So far all I have been able to figure out is that VI can do the batch processing and that "ls -R" gets me the recursive file list. I'm still pretty clueless on how to do the batch process with the VI editor. I think I'm supposed to use the Ex mode but I don't know how to get the list of arguments from the filelist into the editor so they can be processed. If it matters the files were all written in a Windows editor and have gotten the MS carriage returns so I want to do a :set ff=unix command on all the files without having to go into each file manually, there are over 300 files that need updated.
View 3 Replies
View Related
Aug 23, 2010
Is there any program which gets the CPU and memory of a process ?
View 1 Replies
View Related
Dec 8, 2010
I'm trying to build a multi-threaded server "C" program connecting to multiple clients. For various design reasons, I thought of having one port number per client. What is the maximum number of ports my process can handle
View 5 Replies
View Related