Programming :: Make An AWK Script That Goes Over The File Multiple Times?
Mar 11, 2010Is it possible to make an AWK script that goes over the file multiple times, every time doing something different to it?
View 19 RepliesIs it possible to make an AWK script that goes over the file multiple times, every time doing something different to it?
View 19 RepliesI'm porting C++ application from ARM to MIPS platform. It works now, but I see some strange timing problems. I've seen now that My app process is called multiply time. Here is "top" output:
Mem: 24592K used, 102084K free, 0K shrd, 0K buff, 16864K cached
CPU: 0% usr 99% sys 0% nice 0% idle 0% io 0% irq 0% softirq
Load average: 4.02 2.17 0.95
PID PPID USER STAT VSZ %MEM %CPU COMMAND
1888 1875 admin R 12096 10% 98% ./my_app.exe
code....
I don't see something like this when I compile it for x86, nor ARM.On MIPS I use uClibc instead of glibc.
I used wait4 to time a child process. but the results differ each other dramatically. why?my core source code lists as below.to the point: in linux 2.6 kernel, how to time a process with a high precision. and, only its user-time rather than the elapsed time???
static struct rusage ruse;
static pid_t u_pid;
int main(int argc, char *argv[])
{
int i;
code....
I'm programming some skript to get statistical information about some texts. This includes calculating the mean of word lengths.Unfortunately, Umlauts count as two characters. In the example below the output is 9, it should be 6.
sincercly, Max
Code:
#!/usr/bin/perl
use POSIX;
use locale;
my $test = length("ABC���");
print $test;
I have a string problem with a function I am writing and I cant figure it out. I am trying to write unit test which will verify it works as expected. As I need to make use of it elsewhere and obviously robust and correct enough that I can rely on it. Okay first of all I define the following structure
Code:
typedef struct strarray {
int size;
char **elements;
} strarray;
code....
My problem is that upon the 4th iteration in the loop realloc fails in strarray_add. glibc reports invalid next size.
(i) I usually make multiple dir using -p optionex: mkdir -p dicttest/audrep/tdriver/testNow after creating this dir's i stay in current dir instead i want to go directly to test dir how can i acheive this.(ii) When i execute which command as followswhich testerm i will get the location of testterm now i want to open this filewhen i did in this wayhich testterm | vi The file dosent get opened how can i acheive this ?ex:
linuxx86:110$ which testterm
/view/rdl110_linuxx86/vobs_usrrdl/sc/testterm
linuxx86:110$ which testterm| vi
[code]....
I have been working on a project for a while now that involves a rather complex daemon that has to be simultaneously running different tasks. For example one of these tasks is to receive IP packets from the Netfilter queue and place those packets into one of several internal queues. While other tasks involve taking IP packets from those internal queues and processing/manipulating them and finally returning them back to the Linux network stack.
As I as I have no previous C experience before starting this project I just spawned a new thread each time I needed the daemon to be doing something else while those other tasks continued to run. Is there any other way of doing this or is this pretty much the only way of doing this? Because C is procedural I could not figure out any other way of doing accomplishing what I wanted. Should I have done it some other way or is this the correct and only way I could have gotten my C app to be running multiple tasks at the same time?
I have a problem in making multiple calls using PJSIP. I registered different accounts that implements IAccount and added that in the CallManager. When i try to make the calls from the same CallManager, I could able to make the first call. When second call is made the first call got cut and it is alerting and the same for the thrid call..Could anyone help me in this regard.
Note: Calls has to be made from different numbers to different destinations. Is it possible to make multiple outbound calls simultaneously from the same instance of CallManager?
Okay so I have an alias that looks like this:
Code:
ALIAS sorigin {
MSG sorigin Test1
[code]...
I wanted to copy one file to multiple new files. I have an idea to write a script and do the operation. But here i m looking for any particular command to do this operation.
View 1 Replies View RelatedI have a single file that contain multi-text something likes this:
Quote:
No. Time Source Destination Protocol Info
185 27712.068199 192.168.18.23 192.168.18.191 SMTP S: 250 2.1.5 Ok
No. Time Source Destination Protocol Info
186 27715.068293 192.168.0.50 192.168.5.2 TCP suncacao-jmxmp > 44693 [ACK] Seq=1 Ack=1 Win=64807 Len=1380
[Code].....
I have tried multiple times to report a bug, but can't. All I can find is this USELESS guide: [URL]Is this seriously the ONLY way to report a bug? I can't just fill out a form somewhere without running software to do it? When I try to do it the way explained in the guide, it tells me that I'm using a stable version of Xubuntu, and that only people running dev versions (like 11.10) can report bugs.Are they saying that all stable releases are perfect in every way? Surely one must be able to report a bug for them...?
View 5 Replies View RelatedI have a strange effect here, where konqueror is started multiple times. It is no problem to start it from the K-Menu. But konqueror seems to be associated with different actions in applications, e.g. many "help" entries; among others e.g. Inkscape: "Hilfe/Inkscape Handbuch" (~ Help/Inkscape handbook") If I'm unfortunate enough to hit such an item, the konqueror items start flooding my task bar, while the mouse cursor - changed to the konqueror icon - is flickering like wild, while konqueror is starting again and again. None of the windows really open and all icons disappear after some time. (due to some resource overflow, but unfortunately I can't find the relevant log entry this time) How can I prevent this ? (Or debug this, if the cause is unclear)
View 7 Replies View Related[Staff Note: This thread was spun off from here: HOWTO: Purge and Reinstall Grub 2 from the Live CD This solved the Grub problem but the crashes continue.]
Just as I get up and running again my 10.04 (64 bit) either freezes up totally, closes all windows that are open, fails to restart or shut down forcing a restart.
There's no pattern to it, i might be using the gimp or checking thunderbird emails, possibly just surfing or running bluefish. Nothing major and I'm not one to go delving under the bonnet so to speak and start tweaking things. I have the AWN dock installed and run a dual monitor setup.
Everytime it's crashed, the damn thing doesn't reboot, I get the init =bootarg message I've been reading a lot about and once again I have to run the liveCD and spend several minutes farting about purging and reinstalling grub.
I despise Windows, overall I am enjoying my ubuntu experience but things like this stop me getting any work done.
My PC ran fine for the last 2 days then suddenly it's playing up again. It's not an old machine, quad core processor, plenty of RAM.
I am having to back stuff up as soon as I do it due to so many crashes per day. I have reinstalled the OS and started again from scratch 4 times now in the last month.
The last thing I want to do is go back to Windoze but I am seriously running out of patience with ubuntu.
Boot Info Script Results:
Code:
# Boot Info Script 0.55 dated February 15th, 2010
============================= Boot Info Summary: ==============================
=> Grub 2 is installed in the MBR of /dev/sda and looks on the same drive in
partition #1 for /boot/grub.
code....
I have Ubuntu 11.04 on a disk, and installed it on an empty hard drive. When I start my desktop my screen is black with a flashing "_" in the top left corner... Nothing happens. I usually have to restart the computer multiple times before it will actually work. I tried running Ubuntu in recovery mode and fixing any broken packages, but no luck.
View 1 Replies View Relatedhow can I rotate logfiles multiple times a day? I notice that the configuration for the logrotate-command is hourly, daily, weekly,.I notice that I can create a cron job where I specify the different times the log rotation need to be done:15 0,8,12,17 * * *But how do I combine these two ?
View 7 Replies View RelatedMy 5.5 server has crashed on my multiple times over the past few weeks. I have 2 terabyte drives mirrored.It automatically reboots and seems to run fine after rebooting.I've attached a copy of the /var/log/message to this post.I was unable to paste file.I'm not if a bad disk is causing the problem or not.
View 4 Replies View RelatedInitially I thought - use a for loop with ls in it:
Code:
However this causes lots of problems (folders have extensions, I have duplicate folders, the names with spaces create a folder for each element of the name).
The contents of the folder is basically movies (some with subtitles). Some of the names have things like (original) or CD1 CD2 in them.
I have experienced amarok crash after which i am not able to bring it back to working state. I tried to reinstall it multiple times from standart playground and kde KDE:UpdatedApps repositories. Every time. i start amarok it hangs on splash screen consuming 49% of CPU with no signs to load completely. I guess i need to clean reinstall with deleting all tracing info form previous install?
here's output from console:
Code:
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
101003 11:21:54 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
[Code]...
I've reinstalled Grub2 multiple times before, but Ubuntu was on /dev/sda1, now it is not. Here is my partition table:
/dev/sda1 - 105GB - Windows
/dev/sda2 - 200GB - Extended
/dev/sda5 - 110GB - Media
[code]....
On Ubuntu 10.04 I would like to setup udev to execute a backup script when a specific USB drive is inserted. Udev detects the USB drive, but my script is executed 7 times instead of just once. Can't figure out what's wrong.
My udev rules file:
Code:
/etc/udev/rules.d# cat 20-stick.rules
ACTION=="add", ATTRS{vendor}=="Kingston", ATTRS{model}=="DataTraveler G2 ", RUN="/usr/local/bin/sync.sh"
Dummy backup script: connecting USB drive results in 7 times date written to /tmp/test
code....
I am running 11.04 with the Unity environment from a USB stick. With "Ubuntu Classic", I can open up my Home folder multiple times and thus copy files from one location to another with drag and drop. In Unity, it seems I can only open up one occurrence of the Home folder. Does anyone know if multiple Home folders can be opened up?
View 1 Replies View RelatedI want to create multiple documents from within one file. Example:
Code:
documentclass{report}
preamble
[code]....
I just don't get it? I've attempted multiple times to get the knetworkmanager to connect to an unencrypted network, yet it keeps asking for a wep key. However the networkmanager in the Gnome version connects to unencrypted networks just fine. Why won't knetwork manager do the same?
View 9 Replies View RelatedIt's been awhile since I've been on here. I suppose that can be considered a good thing, since I made the completely transfer to Ubuntu three months ago and everything's been running completely smoothly. Anyway, security is a pretty big thing to me. I usually change the root password, take sudo off (and default gksu, not gksudo), encrypt my hard drives, etc... One thing I also do is create a separate password for my login keyring. I don't mind having to enter one extra password at login, but it started prompting two times, and now three. It's the same password every time, so my question is..
View 4 Replies View RelatedI have the follwoing fenomenan. In my /etc/fstab I have an entry to automatically mount my NAS. Here is my entry:
192.168.1.10:/mnt/array1/My_NAS /media/My�40NAS nfs _netdev,
auto,rw,hard,users,intr 0 0
When my laptop boots it successfully mounts the NFS NAS and I get an icon "My NAS" on my dekstop that points to the NAS. If I double click on the icon it opens my file browser and I can browse thru my NAS fodlers.
What I see on the left hand side of the file browser is that I have to entries for My NAS. One of it has a button to shows that it is mounted and the other does not.
If I go to Places I also see 2 entries for "My NAS". One of it takes me to browsing the NAS and if I click on the other it says "Unable to mount ... busy or already mounted". Which makes sense.
For example, I have a text file with data which lists numerical values from two separate individuals
Code:
Person A
100
[code]...
I've been trying to sort this out for several hours and I?m totally lost? I?ve been searching around, but haven?t found the solution to my problem. I have a directory with 100 files. I need to copy 10 lines of each files (let?s say from line 45 to 55) into one unique file. So I guess I could use sed ?w, but I didn?t manage to write the right script. I also tried using a loop to create 100 different files, each one with the 10 lines) to concatenate them later on. But I only got 1 file, not 100.
View 12 Replies View RelatedI have a very, very large log file (360MB) that I'm trying to thin out. As it turns out the majority of this file has entries that aren't necessary so I'm attempting to build a command that will strip these out. The following command works to display only the data that I do not want:
Code:
cat xml_results.log | grep -B 6 -A 5 "YYY ZZZ"
This displays exactly the data I want to delete from the file by displaying the expression and six lines above it and five lines below it. However I'm at a loss as to how to remove this data from the output and display everything else. I looked into the -v option with grep redirecting the output to a new file:
Code:
cat xml_results.log | grep -B 6 -A 5 -v "YYY ZZZ" > xml_filtered_results.log
However it doesn't work, the new file is the same size as the old one. What am I doing wrong? Is there a better method of doing this? I'm a bit out of my element since the method I'd normally use can't handle files of this size.
I have a file looks like the following:
digraph topology
{
"192.168.3.254" -> "10.1.1.11"[label="1.000", style=solid];
"192.168.3.254" -> "10.1.1.12"[label="1.000", style=solid];
[code]...
Order of these lines are random... So I cannot delete line #19, for example... And you can see that top four lines I want to delete are pairs. So there might be some clever way to detect the lines, if a line has both "1.9" and "1.11", then delete the line... I am new to perl language. The following is the code I have now... I think I just need to write some code inside the while loop checking if I want to delete the line $dotline before I write to a NEW file.
Code:
#!/usr/bin/perl -w
$TOPPATH = "/tmp";
$NAME = "topology";
$FILENAME = "$TOPPATH/$NAME.dot";
[code]....