Programming :: Create Awk Sript For Generating Two Files From A File Checking A Condition ?

Mar 3, 2010

I have a csv file like, having HDR segment and multiple LIN01 segment in each line:like

Here i want to split file in two, one having LIN01 segment which have LR at end, and one which have LF at end in LIN01 segment.

Is it possible to created awk or shell script for this?

View 3 Replies


ADVERTISEMENT

Programming :: Generating Files With Different Names At Each Loop In Fortran?

Nov 7, 2010

I am trying to write a loop to open four main-data-files. At each open of the main-data-file, I want the loop to open another four sub-files and split the data from the mail-data-file according to the creteria and dump into the four files. When the loop goes to the second main-data-file, it shall generate another 4 sub-files with different file name. And the process goes on. That means I will have total of 16 sub files for the four main-data-files. Each four files from the 16 files shall have specific name on it. Based on the code which I given below, I would say when the file at UNIT=100 is opened, 4 new files needed to be opened as well. They are:

maximum_dist_001_064.dat
maximum_dist_065_128.dat
maximum_dist_129_192.dat
maximum_dist_193_256.dat

View 1 Replies View Related

Programming :: Generating Avi Files For Movies Directly From Gfortran Programs ?

Mar 5, 2011

Generating avi files for movies directly from gfortran programs. I make movies from my Fortran codes using seismic unix - SU. Need to modernize this method to make avi movies or something similar. I am quite adept at generating "C" binary files from Fortran. Have not been able to find the documented definition of AVI file format.

View 1 Replies View Related

Software :: Bash Command Or Sript To List Files?

Aug 25, 2009

need a command or script to list all files recursive without directories one line per file, no extra lines like ls -AR1 should print file size and name eg.:

12 file.ext
25684 file2.ext
589 file3.ext
...

View 7 Replies View Related

Programming :: Bash Checking For File Write Completion Before Acting?

Jan 20, 2011

I have a bash script that checks for contents in a folder every 15 seconds and then acts on it's contents. This works great for the average size file however on very large files it starts acting on the file before it's completely written. Is there a facility in bash shell to get a file complete signal or such? here is trigger to launch a larger script.

Code:

#!/bin/sh
while true
do
$HOME/bin/hpgl.sh >/dev/null 2>&1 &

[code].....

View 10 Replies View Related

Programming :: Suspend Pthreads Without Condition

Jun 29, 2010

I just started with Pthreads and don't really know much about it. I want to suspend pthreads but apparently, there is no such function as pthread_suspend. but I don't understand why we need both mutex and condition to suspend and resume a pthread. Is it possible to suspend and resume it without using conditions?

View 1 Replies View Related

Programming :: Awk: Swap Fields Given A Condition?

Oct 8, 2010

I have a file records as follows:

Jane pepe@pepe.biz
john@pepe.net John
Joe joe@willxyz.org

How can I get that always first field be given name and second one be the mail address?

I've tried

Code:

awk '$1 ~ /@/ { a=$1 ; $1=$2; $2=a; print }' file

But that doesn't worked

View 5 Replies View Related

Programming :: Iptables Script With For Condition?

Apr 28, 2010

i have a question regarding the use of a statement, like following, in a iptables script.

Code:
BLOCKMAC="/root/mac.blocked"
MACS=$(grep -Ev "^#" $BLOCKMAC)

[code]...

View 2 Replies View Related

Programming :: Update A Line Using AWK With Condition?

Jun 18, 2010

i have a host file called myhosts.txt as follow:

Quote:

10.20.3.9 host1
10.20.3.10 host2
10.20.3.11 host3

[code]...

In my script, i am using NSLOOKUP to get the ip address of a host that just rebooted and connected to my network (this part has been done).But now i want to check the myhosts.txt file if the host has the same or different IP address, if is different then myhosts.txt file must be updated with the new IP.i am using the following AWk command:

Quote:

awk '/host4/{$1=val}{print}' val=10.0.3.4 /tmp/myhosts.txt

it prints on screen fine and i see the host4's ip address gets replaced but the actual file does not get updated with the new IP. I might need to use gsub?

View 11 Replies View Related

Programming :: Use If Else Condition When Returns Empty Data?

Apr 27, 2010

Let say I would like to check /etc/profile whether defined umask 022

umaskcheck=$(What to defined here?)
if [ What to define here? ]
then

[code]....

View 2 Replies View Related

Programming :: Bash: Repeat Commands Until A Condition Is Matched?

Mar 8, 2011

need to modify some scripts to repeat the commands in them until a variable returns a proper value. I need it to add some redundancy to some scripts i use to upload files to a remote server.This is an example of a portion of those scripts:

Code:
################## site UPLOAD ##################
site_login=$(curl -c $site_cookie -L -F user=$site_user -F pass=$site_password -F

[code]....

View 4 Replies View Related

Programming :: BASH Conditionals - Passing Condition As Variable ?

Sep 17, 2009

I'm trying to implement an assert function similar to:[url]

However, I'm having trouble with file existence testing when the file name has a space in it.

I have distilled the problem down to the following:

This code works as expected, printing 'yes' if '~/test file' exists, and no if not.

Code:

However, this code gives an error.

Code:

The error:

Code:

Which tells me that it is splitting ["~/test file"] into ["~/test] and [file"]. Why? Is there a way around this?

Note that if you simply use a file path without a space, both cases work perfectly. Is this a BASH bug possibly? I just can't understand why the first would work, but the second wouldn't.

View 8 Replies View Related

Programming :: Generating Excel Charts From C?

Feb 24, 2011

how to generate excel charts from C, or if it's possible at all? For example, if I had 2 arrays that I wanted to export to excel and graph against each other. I know how to export it to a csv file, that's no problem, but I have no idea where to start with generating a graph of the data. I can't seem to find any examples anywhere. Just a simple example to show you what I mean: Code:

char arr1[] = {'a','b','c'};
int arr2[] = {10,20,30};
int main ()

[code]....

View 5 Replies View Related

Programming :: Code For Generating A Pop-Up Window In C

Aug 4, 2010

Unfortunatelly since i have no background at all about GUI programming, i dont know even the keyword for that i want to generate a pop up window from my program (written in C) which show a message and an OK button. in my opinion, maybe i should use directly the Xlib library and not the GTK or QT library for example so the program can work almost on every linux system. A code snippet/hint for the pop-up window then?

View 2 Replies View Related

Programming :: Generating Grpah Form Rrd On The Fly?

May 9, 2010

Im strugling with script that wil generate graph on demad. I put it in cgi-bin directory but cannot get it to work. i googled for perl generating images and tried few examples but none worked.

When I execute perl script in command line it throws picture i a bunch of characters so it creates it but wont show when I access it through a web page.

[Code]...

View 3 Replies View Related

Programming :: Generating Prime Numbers In C?

Mar 9, 2011

I'm trying to write a program that generates a random number and then tells if it is prime or not. I have doe some research about how to calculate prime and random numbers but I'm still having trouble. I don't really get how to calculate a prime number. I know a prime number is a number that is divisible by 1 and and itself. how to calculate a prime number in C?

View 10 Replies View Related

Programming :: Generating Timer Interrupts In C?

Jul 23, 2010

I'm trying to understand how interrupts work. Is there a way to generate timer interrupts in C. Also can we enter into the protected mode of the CPU. Does OS (specifically, linux) place any restrictions on user programs entering protected mode. If it does not, do we just have an assembly language program which changed the mode, followed by the C code... I'm just trying to understand how things work at the lowest level. So I'm trying to write few snippets to test my understanding.

View 3 Replies View Related

Programming :: Generating Series Of Numbers Of Sequence?

Mar 19, 2011

I am trying to generate sequence of number in the order of :

1
2
3
4

[Code]....

View 7 Replies View Related

Programming :: Generating Makefile Ans Configure Script ?

May 17, 2011

I know how to manually writing a makefile for my project, but I am new in using makefile & configure file generation tools like automake to generate a makefile and a configure script file.

I had done research on tutorials for generating makefile and configure script file.

I know that I need to manually write two files (makefile.am and configure.in).

I use wxWidgets GUI library, libconfig library, and libpcap library to do my project.

wx-config is a tool that can return the library files and include directory for wxWidgets library.

When using g++ to compile my files, I need to add in this line "`/wxlib/bin/wx-config --version=2.9 --static=yes --unicode=yes --debug=yes --libs`"

How to add that line to the makefile.am file?

View 1 Replies View Related

General :: Remort Loging - Check For A File Existince And Display A Message - If Condition

May 31, 2010

I want to ssh and check for a file, I hve came up with following, and its not working,

Is this possible or do I have to do this in a another way.

View 5 Replies View Related

Programming :: Create A Duplicate File Of A Text File In PHP?

Nov 11, 2010

What I plan to do is, create a duplicate file of a text file, and then append some text into the new text file.

View 1 Replies View Related

Programming :: Bash - Generating A Table With Aligned Fields

Apr 9, 2009

I want to write a function which calculates the space needed between fields, to generate a table with aligned fields, like when you type "ls -l", the operating system generates a table with beautifully aligned fields. I've got this code so far:

Code:

for line in $(cat tmpSearch)
do
line=`echo $line | tr ":" " "`

[code]....

View 2 Replies View Related

Programming :: AMD CPU Generating Way More System Load Than Intel Xeon CPU?

Oct 11, 2010

I am running some muti-threaded code that uses a lot of memory (~6GB). I have it compiled on a cluster that uses Xeon 5160 quad core CPUs with 4MB cache/core, 8GB of RAM and kernel 2.6.18 (x86_64) and I have also the same code compiled on another cluster that uses Opteron 2214 quad core CPUs with 1MB cache/core, 8GB of RAM and kernel 2.6.28 (x86_64). On the Intel cluster the code generates barely any system load when I look on top but on the AMD cluster it can generate over 50% of system load. On the intel machines my process can generate a constant load of 3, while the load generated by the process on the AMD machines is about 1.6.

Does anybody know what could cause this? Could it be the version of the kernel or the difference between the CPUs (for example, the much smaller cache of the AMD CPUS)? My software and all its dependencies are the same on both clusters. I am also using the exact same version of GCC to compile everything.

View 1 Replies View Related

Programming :: Bash: Generating A Random LETTERS Sequence?

May 12, 2011

I tried googling around but i cant find anything related to this: everyone seems just interested in random numbers, so when it comes to random letters there is a lack of informations. However, i am trying to figure out a wait to get a random letters string that matches a simple rule: it must be a sequence of consonant+vowel. So for example, these are some 6 letters strings i would like to obtain: wolupa, tafoke, zewevu, cupimo.

View 3 Replies View Related

Programming :: Generating Keyboard Events In Shell Script

Nov 23, 2010

Is it possible to generate keyboard event "Ctrl+c" from a shell script code.? I have written a shell script to compile my application and copy it to the server home directory, inorder to run my application I need to start the server (by running a shell script). But before that I need to stop the the currently running instance of my server. To do that I have to generate a keyboard event (Ctrl+c which I press it manually). I want to automate the entire process by writing a shell script I am able to run the server just by adding ./run.sh in my shell script. But before that to stop my server can I generate a keyboard by using a shell script event(ctrL+C) to stop server.?

View 2 Replies View Related

Programming :: Create Inverted Files To Associate Files To Numbers ( Numbers Being The Index Of My Paths )?

Apr 4, 2011

am writing a small search program for my class. I have decided to use indexing for my program. Ive researched online about indexing and how search engines do it. If im gonno do that I need to create inverted files to associate files to numbers ( numbers being the index of my paths ) . Now I was wondering what would be the best way to create an inverted file ? I was going to create sql tables using mysql api in C but then again there is no array data type or vectors to store few numbers in a single column in mysql and it is not advised to use Enum or SET

View 14 Replies View Related

Ubuntu Installation :: Can't Create Japanese Locale: Get A Segmentation Fault On Generating Locale?

Oct 13, 2010

Maverick 10.10 is unable to create Japanese locales on my wife's laptop (Acer Aspire 3000). This machine previously had no such problem. The install is a fresh install, since the machine froze during the upgrade (no fault of Ubuntu's). A possible complication is that it froze several times more during the install, and I have gone through many recovery boots and iterations of dpkg configure. All relevant packages are installed, I believe. Everything else works. Through System, Administration, Language Support, I have installed all components of English and Japanese. Currently English is selected. Japanese should appear in the list but does not. Japanese text appears properly, and I can write in Japanese,But all the menus are in English. Fine by me, but my wife will want Japanese when she uses the computer again (not soon).This mostly likely is a glibc/libc6 problem, as far as I can tell. I can't find any other Ubuntu user with this problem recently.And now, some outputs:1. dpkg-reconfigure locales

sudo dpkg-reconfigure locales
Generating locales...
en_AG.UTF-8... done

[code].....

View 1 Replies View Related

Programming :: How To Create A Log File

Oct 7, 2010

can any body tell me how to creat a log file in linux...when i run the script the details must go to log file...

View 8 Replies View Related

General :: Generating A White Noise Audio File?

Jan 3, 2011

My apt gets noise from outside. I would like to generate a white noise audio file and play it to block outside noise. I would prefer something like the low frequency hum of a big fan. How can I generate this file in using linux tools?

View 14 Replies View Related

General :: Generating SSH Key At The Console - What File Needs To Be Copied To Usb Drive

Feb 17, 2011

I've been giving the task to go to a Linux console as root. and generate a ssh rsa 4096bit key, and copy the private key to a USB drive.

1) What command should I use here? ssh-keygen -t rsa -b 4096 ?

2) Do I need to append the new private key to the authorized_users file? Which file exactly must be appended there? Would this be sufficient?

mkdir -p /home/myuser/.ssh
cat id_rsa_LOCAL.pub >> /home/myuser/.ssh/authorized_keys

Should any special permissions be applied to this file?

3) Which file must be sent to my usb drive so that I can take it home to connect with?

View 5 Replies View Related







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