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


ADVERTISEMENT

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 :: 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

OpenSUSE Wireless :: Eth0 Not Aligned And Wlan Not Aligned?

Aug 6, 2010

I use with 11.2 a network without problems.Now I installed in the same PC on another hdd 11.3 and get in yast2 network the messages:eth0 not aligned and for wlan too.My driver realtek r8192s_usb What can I do? adda7,

View 1 Replies View Related

General :: Generating Two Bash Arguments From 'ls'?

Jul 3, 2011

I have a directory containing the following files.

Code:

1-res-opt-I189N-0001.pdb
1-res-opt-I189N-0002.pdb
1-res-opt-I189N-0003.pdb
1-res-opt-I189N-0004.pdb

[code].....

What I want is something like:

Code:

for i in *.pdb
do
python my_script.py 1-res-opt-I189N-00{1..10}.pdb 3-res-opt-I189N-00{1..10}.pdb
done

such that always the two files with corresponding index are submitted together to the Python script. How do I do that?

View 4 Replies View Related

Programming :: Making Dynamic Memory As 64kB Aligned In C Lang?

Aug 17, 2010

I doing malloc and getting the chunk of dynamic memory. Now I want it to align that memory to 64KB. This means that the address of the memory starts from 64KB or multiple of 64KB.

View 3 Replies View Related

Programming :: How To Remove Last Two Fields

Apr 27, 2010

I have a filename file-name-here-1.2.3-i486-2.tar I would like to know how to remove the last two fields leaving only: file-name-here-1.2.3

I can use:

x=file-name-here-1.2.3-i486-2.tar
echo ${a%-*}

to remove the last field (after -) but how do i remove the last two in one fell swoop?

View 2 Replies View Related

Programming :: Script To Delete Aligned Single-character Columns With No Field Separator?

Apr 20, 2010

The lines beginning with greater-than symbols are the sequence descriptors and the lines immediately after each descriptor with A-Z characters, dashes, and question marks are the aligned DNA sequences. The sequences are always the same length within a file and never span/wrap across more than one line.I am trying to write a script to remove positions in the sequences that are only represented by a -, X, ?, or N (these represent gaps or missing data). Also, if there is exactly one non-gap/missing character in a position it is also useless (there is nothing to compare it to) so I would like to remove those positions as well.

Position 5 (from the left) was removed because it was all gap/missing characters. Position 9 was removed because only one character was a non-gap/missing character. Position 10 was retained because there were 2 non-gap/missing characters.I'm really not sure where to start here. My first concern is I can't figure out how to tell awk to treat each character in lines not containing a greater-than symbol as a separate field. After that, I'm thinking I should use set up a counter to count the number of lines with gap/missing characters comparing that to the total number of lines not containing greater-than signs?

View 14 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 :: Finding Common Entries In Fields Using Awk?

May 31, 2010

I want to extract all the common entries in the given 3 columns(fields) in the file using awk::can somebody tell me how it can be done in awk...the file is::

NC_000858.pttNC_000858.fnaNC_001403.rnt
NC_001362.pttNC_001436.fnaNC_001407.rnt
NC_001364.pttNC_001503.fnaNC_001488.rnt

[code]....

View 8 Replies View Related

Programming :: Compare Files With Fields Separated With ':'?

Jul 16, 2011

Dear expertsI have files like

ABD : 5869 events, relative ratio : 1.173800E-01 , sum of ratios : 1.173800E-01
VBD : 12147 events, relative ratio : 2.429400E-01 , sum of ratios : 3.603200E-01
SDF : 17000 events, relative ratio : 3.400000E-01 , sum of ratios : 7.003200E-01

[code]....

View 3 Replies View Related

Programming :: Limit In Number Of Fields That Awk Can Handle

Mar 2, 2011

I have a file with 200 000 lines and I want to append the fields of each line based on matching first field. The resulting file should have 70 000 columns but has "only" 18 000. The command I'm using is working perfectly with a smaller file, wich lead to 14 000 columns. Could there be a limit in number of fields that awk can handle ? Here's my awk command :

Code:

awk -F, 'END { for (k in _) print _[k] } { _[$1] = $1 in _ ? _[$1] FS $4 : $1","$4 } ' file > out

Also, this command writes ^M (windows line break) after each columns. Removing them is easy but where do they come from ? Working on Ubuntu 10.10

View 4 Replies View Related

Programming :: Split Fields In A Perl Array?

Dec 16, 2010

I have an array called @logons. How can I step thru the array and split the fields? This is what I have so far, but doesnt work. I got the feeling I the split statement syntax is incorrect.

Code:

print @logons;
foreach my $logons(@logons){
($userid, $ip) = split(',',$logons);

[code]....

Update: Appears the data in @logons has a column header from the mysql query which I used to populate it with. So that code which I was testing does indeed work.

View 10 Replies View Related

Programming :: Show The Output Of These Fields In A Certain Way That Every Record Is Numbered?

Mar 25, 2010

i am reading a database flat file with the "awk" command which has 4 fields separated by colon ":" .I want to show the output of these fields in a certain way that every record is numbered e.g

1.some text
2.some text

Is there a way to do this?

View 14 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 :: While Receiving Can Use Functions Like Strchr() To Differentiate These Fields For Sockets?

Apr 15, 2009

constructing a protocol where in it involves sending and receiving different files, so sending data over consists of file name, size of the file and content of the file, so while receiving can i use functions like strchr() to differentiate these fields for sockets? so to allocate memory for file to save i need to have its size.

View 3 Replies View Related

Programming :: Updating A Sequence Of Datetimes In Fields With Unique Contrains

Mar 14, 2010

I am faced with the following problem; I need to update all fields of type datetime without ... with the following sort data:01-01-2010 12:10:30.256 - this is just an example.these fields are restricted with a unique constrained. My question is how can I generate the above sort data, especially the last three numbers with leading point. After that how can I update a table with existing data with this newly generated data so that the fields really do carry unique data.As you probably can read out of my question, I read through the help in pgAdmin and came as far as generating date, maybe datetime but not the .123 number. And a little insert script I found in the help, that I modified as UPDATE resulted in updating only the last generated data in all required fields.

View 7 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

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 :: 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 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 :: 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

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 View Related

Programming :: Formatting Fields And Text Being Displayed From Text File?

Feb 9, 2011

I want to display the contents of a particular log file (simple text file, I mean in Linux). But there is a problem: The contents need to be organized in a fixed format. Have a look at this log file:

sampleLog.txt

Code:

User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!

[code]....

So, while displaying the contents of above file on a web page, I want to format the field names found in the log file: User Name:, Reported Problems Description:, and Remarks:. These fields may contain a variable length of text and no specific line number is assumed for them to appear on.

The desired output should look like this:

User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!

[code]....

Well, what I am trying to do may sound wierd to some of you. The filed "Reported Problems Description:" can possible contain text which embeds colon (.

View 15 Replies View Related

Programming :: Bash: Printing The Line Number In Bash Script?

Feb 4, 2011

I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.

View 3 Replies View Related







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