Ubuntu :: Parse Line With Colon Field Separation?

Jan 16, 2011

Source:

Code:
JAMES ::: AAAA ::: 1111
JANET ::: BBBB ::: 2222
LAURA ::: CCCC ::: 3333

[Code].....

Is there a way to do this from command line?

View 7 Replies


ADVERTISEMENT

General :: Remove / (slash) And Replace - (semi-colon) With New Line

May 6, 2011

I need to have a shell script which does the following,

1. Remove '/' in the file
2. Replace ';' with new line

Input file (sample):

TL/01039;TL/07014;TL/07016;TL/07046;TL/09476;TL/09522

Output file should be:

View 2 Replies View Related

General :: Parse A File And Print Each Line That Ends With Matching Pattern (if The Next Line Is Blank)

Aug 2, 2010

I've written a script to parse a file and print each line that ends with matching pattern, if the next line is blank. The pattern lines are the result of md5sum $i|sed 's/path///g' so that only md5 and filename appear. Here's what I'm using.

Quote:
for fline in `sed -n '/.*.ext$/p' file1`
do
if [ "`sed -n -e '/'"$fline"'/ {n; p;}' file1`" == "" ]
then
echo ""$fline" has no info" >>file2
fi
done
[Code]....

View 4 Replies View Related

General :: Parse Command Line Arg Using Getopt()?

Apr 1, 2011

I am trying to parse command line arg using getopt().this is my code

int main(int argc, char** argv)
{
int a=0,b=0;

[code]....

View 1 Replies View Related

General :: Shell Scripting: Parse Parameters From Command Line?

Mar 12, 2010

myscript [-a a-arg] [-c c-arg] [-b] [-e] somedirectory

Given that I want my shell script be invoked at the command line using the above parameters - where [these brackets] denote that they are optional - what is the best method to parse them?

View 1 Replies View Related

Programming :: Move Line Of Pipe Delimited Flat File If Field 27 = Sold?

Sep 26, 2010

I have a pipe delimited flat file, field 27 is price. I would like to move items marked sold to a new file every couple months.

awk -F"|" '$27 == "SOLD" {print $0}' awktest2.data >> awkout2.data

Allows me to write line to new file but I need to delete the original line, I also want to make sold case insensitive tried [Ss][Oo] with no luck

View 4 Replies View Related

General :: Parse A Line From A File And Place The Values Into Separate Variables?

Sep 28, 2011

I am trying to parse a line from a file and place the values into separate variables:

input.txt:

Code:

CreateVegaFeed-20110928-before-skip-start

this is the code i have done so far:

Code:

$input_file="input.txt"
INPUT_FILE=`cat $input_file`
for i in $INPUT_FILE

[Code].....

View 14 Replies View Related

General :: Bash Script To Parse A File To Get A Set Of Line Between A Specific Characters?

Dec 23, 2010

I have a log file that contains information like this:

----------------------------
r11141 | prasath-palani | 2010-12-23 16:21:24 +0530 (Thu, 23 Dec 2010) | 1 line
Changed paths:
M /projects/
M /projects/

[code]....

what i need is, i need to copy the data given between the "---" to seperate files, for, e.g. the first set of data between the "---" should be in one file and another set of data in another file.

View 5 Replies View Related

OpenSUSE Install :: Yast Hangs At 99% Downloaded - Aria2c Can't Parse Progress Line [11.3] / Fix It?

Sep 6, 2010

I've just upgraded to 11.3, as a result, the suse-supplied video driver runs very slowly (screen-saver updates about 2 fps, to give you an idea) On 11.2, I had installed nvidia's native driver and things were just fine, so I tried to install the latest nvidia driver again, but I'm getting a hard hang with Yast -- at 99% downloaded, yast stops responding ("abort" doesn't respond, but an external "kill" signal works)

Finally getting the bright idea of checking the y2log file, I see the following code...

these three lines are repeated every second

I'm sure there are some fingers to be pointed [nvidia's ftp server is borked; aria2c is clueless, etc] but that does not help me - what do I need to do to convince this "aria2c" program that the file has, in fact, completely downloaded so that the installation process can continue?

View 6 Replies View Related

General :: Field-terminating Char Appears Within Field Values?

May 18, 2010

I've had a very colorful morning learning the innerparts of Linux's sort command, and have come across yet another issue that I can't seem to find an answer for in the documentation. I'm currently using -t, to indicate that my fields are split by the comma character, but I'm finding that in some of my files, the comma is used (between double-quotes) within values:

Jonathan Sampson,,foo@bar.com,0987654321
"Foobar CEO,","CEO,",ceo@foobar.com,,

How can I use a comma to terminate my fields, but ignore the occurences of it within values? Is this fairly simple, or do I need to re-export all of my data using a more-foreign field-terminator? (Unfortunately, I do not have any control over declaring a different terminator with this particular project).

View 2 Replies View Related

Programming :: Awk - Print A Field When Field Position Is Unknown ?

Mar 28, 2010

I'm trying to display fields from flat files where the first 8 fields are always the same. Fields 9 - n are varied but will contain specific patterns I'm after. I'm using this so far because "mySearch" is on each line I want to examine.

Code:

How would you pattern match and include 2 additional fields above field $9 but change field position from line to line?

View 12 Replies View Related

Ubuntu :: E - Malformed Line 57 In Source List /etc/apt/sources.list - Dist Parse

Jun 25, 2010

I get this error message: E: Malformed line 57 in source list /etc/apt/sources.list (dist parse)

I am pretty new to Ubuntu and dont really understand computer

Here is the sources list (??) as well

View 3 Replies View Related

Programming :: Sed - Get All Text After First Colon?

Feb 28, 2011

This will probably be a simple question for the experts here, but I've been googling and testing and trying for a few hours with no luck. I'm tired and stumped. My simple test case:

Code:

$ cat test.txt

First colon: Get everything after: first colon.I want to return all the text after the first colon. So that would be "Get everything after: first colon." This is what I currently have:

Code:

$ sed 's/.*: //' test.txt

first colon.This returns everything after the second colon.

View 5 Replies View Related

Programming :: Awk Printing From Nth Field To Last Field

Jan 8, 2010

How can print the, let's say 5nd field to the last field of every record (let's say we have 10 fields)?

I mean: I cant avoid to have to do:

print '{$5 $6 $7 $8 $9 $10}'

View 2 Replies View Related

Programming :: Php - Get A Return From A Field Within A Field?

Apr 27, 2009

I am creating a game with random variables. In the game I have created a dialogue exchange to players. I have set up a table with various returns and I inserted {$fields} to represent various random variables. When I call on the requested fields, I only see the field text and my field names. Am I supposed to parse something and call it back another way?

ie: myfield is: "You have won {$random1} silver! <br />{$wi['gender'] majesty rewards you well." the code I am using to call that field is:

View 11 Replies View Related

Ubuntu :: Error Dpkg: Parse Error, In File '/var/lib/dpkg/available' Near Line 2 Package 'x11proto-core-dev'

Sep 18, 2010

When I tried to upgrade my xubuntu 10.04 , I got this error

dpkg: parse error, in file '/var/lib/dpkg/available' near line 2 package 'x11proto-core-dev': value for `status' field not allowed in this context E: Sub-process /usr/bin/dpkg returned an error code (2)

View 5 Replies View Related

Programming :: Get A Field Value Corresponding To Another Field Value?

Dec 14, 2010

i have a file : file.dat with following data

Code:

STORAGE PERCENTAGE FLAG:

/storage_01 64% 0
/storage_02 17% 1
/storage_03 10% 0
/storage_04 50% 1

I need to get the value of PERCENTAGE in a variable for a value of storage passed as variable i have tried the following without success like :

Code:

percentage='awk -vx="$defaultStorage" '{FS=OFS=" "}$1==x{print $2}1' file.dat

View 2 Replies View Related

CentOS 5 :: Is The Separation Of OS Drive And Data Drive Recommended

Jan 13, 2010

- 160gb is where i install CentOS (pretty much the hard drive for operation system) - Lets call this drive A

- Two 1TB drives run in RAID 1, using software RAID (this is where i will store personal data, pictures, movies, music, etc...) - Lets call this RAID 1 setup drive B

I am planning to run a virtual Win Server 2008 using Xen and have that be my domain controller. I will use samba to share drive B and have the network drive map when user login to the domain.

- If for some reasons i have to reinstall CentOS, this pretty much mean drive A will be formatted and reinstalled. Knowing my self i probably will goof up some config in CentOS and will need to reinstall the OS to fix it. Since drive B will be the centralize location for my home network, i dont want to lose the data. Will i be able to re-setup the RAID setup of drive B and still have all the data stored on it intact after a reinstall?

- Is the separation of OS drive and data drive recommended?

- Are there any better way to accomplish my setup? I am pretty much just looking to make a linux file server and windows on client's end.

View 3 Replies View Related

Programming :: Copy And Replacing Specific Line From File1 To File2 Line By Line

Mar 22, 2011

I have two files, file1.traj and file2.traj. Both these files contain identical data and the data are arranged in same format in them. The first line of both files is a comment.

At line 7843 of both files there is a cartesian coordinate X, Y and Z ( three digits ). And at line 15685 there is another three digits. The number of lines in between two cartesian coordinates are 7841. And there are few hundreds of thousands of lines in a file.

What I need to do is copy the X Y Z coordinate (three digits) from file1.traj at line 7843 and paste into file2.traj at the same line number as in file1.traj. The next line will be 15685 from file1.traj and replace at line 15685 at file2.traj. And I dont want other lines (data) in file2.traj get altered. This sequence shall be going on until the end of the file. Means copy and substitude the selected lines from file1.traj into file2.traj.

I tried to use paste command but I cant do for specified line alone.

Here i showed the data format in the file. I used the line number for clarity purpose.

Code:

View 10 Replies View Related

Programming :: Access A File Line By Line, And Check The Length Of Each Line.

Feb 13, 2011

I want to access a file, and check the length of every line.After, i want to check and replace all lines with length over 10 characters, with a message.Does anyone have a clue on that?

View 1 Replies View Related

Ubuntu :: Parse Mac Address From Arp -a

Jan 24, 2011

I'm using arp -a to get the mac address of the router I am connected to. This is the first line of the output:

Code:
? (153.106.80.1) at 0:50:3e:97:dc:a on en1 ifscope [ethernet]

I want to grab the mac address from this. I know that I probably need to use sed with a regular expression like [0-9A-F]+: but I am not sure how to do this.

View 1 Replies View Related

Ubuntu Multimedia :: Set ID3 Genre Field To Podcast?

Jun 27, 2010

Set ID3 genre field to podcast?

View 2 Replies View Related

Ubuntu :: OpenOffice. Can't Edit Text Field?

Nov 5, 2010

I use Ubuntu 10.04 and OpenOffice 3.2.We have forms we use for computers we sell. I have to fill out a profile. The problem is I cannot enter text into the text entry fields. I get this error:"Readonly content cannot be changed. No modifications will be accepted."Here is a link to one of the files. If you try to enter more that a digit or two in a text field, you get that error:[URL]

View 9 Replies View Related

Ubuntu Networking :: Use Variables In The Url Field In Firefox?

Mar 27, 2011

"Once upon a time", I think heard of a way to use variables in the url field in firefox(or maybe it was ubuntu in general?).Anyways, if one would type, for instance, "google pokemon," the url would be changed to

View 2 Replies View Related

Ubuntu :: Field 'struct' Has Incomplete Type

May 13, 2011

I'm building a symbol table and syntax tree using lex and yacc for a compiler.

I am stuck with an error for too long. I have defined two structures (one for Symbol Table and another for Syntax Tree).

Code:
typedef struct symbolTable{
char name[30];
.....
struct symbolTable *next;

[Code]......

here's the error:

bottomup.y:76: error: field 'info' has incomplete type.

I tried to define the structure definitions in a separate header file and included in .y file but it didn't work out.

I'm trying to get this done ASAP.

View 1 Replies View Related

Ubuntu :: New Login Theme - Cant Get To Password Field

Jun 2, 2011

really only have played around with it off and on. I just installed a new login theme usimg Slim (the Fingerprints theme) and now whenever I restart the virtual machine (using VMware player) it will let me type in my user name but it doesnt show my cursor and wont let me tab down to my password field so I cant get in and change it back to a different theme. Is there any way that I can fix this or will I need to reinstall the whole thing?

View 1 Replies View Related

Programming :: Compare Two Files Line By Line And Print The Line Which Is Same?

May 30, 2011

I am trying to write a program in C which compares two files and prints the line that is equal.

Here file1.txt has

and file2.txt has

Note: file2.txt consist of only a single string where as file2.txt has multiple lines. Actually im comparing two files with md5sum values.

Here is the code but it compares only first line of files..but it should compare the whole file1..and sorry iam a beginner in C can any1 sujest some modification to this code so that..it can compare file2 with entire file1

Quote:

View 9 Replies View Related

Programming :: Insert Line Using Sed Or Awk At Line Using Line Number As Variable

Jul 25, 2011

I want to insert a line at a particular line number using sed or awk. where line number is not fixed and is in form of variable.

I want to use variable in sed or awk command.I tried something like below, but no luck.

View 7 Replies View Related

General :: Keep Last 'n' Characters Of A Specified Field?

Apr 4, 2010

The input file consists of several fields. The first field is always five or more characters long. I want to keep the last five characters of the first field.

Example:
If the input file record is FEDERAL PACIFIC ELECTRIC PRODUCTS then I want to keep DERAL I can do this in four steps by using C, REV, C, and REV again but that seems like doing an easy thing the hard way. Is there a straightforward way to achieve this result with C or some other command?

View 14 Replies View Related

Ubuntu :: Why Is The Text Field For The Path Not In Nautilus Anymore

Feb 26, 2011

Why do you have to press ctrl-L to use the location text box in Nautilus? There used to be a setting in preferences where you could have it always use the text bar. Now you have to use some gconf command in the terminal. The gconf command I've used also will only work for normal users. If I want to open a root nautilus terminal to move files around between my mounted drives then I have to hit ctrl-l every time. It is really annoying because if I am in a Nautilus window there are lots of times where I need to copy the path to something I am doing in the terminal.

Why does it seem like everything involved with Ubuntu is simplifying things at the expense of having options? I thought GNU/Linux was all about options. I guess it still is, but I just cannot understand why you would completely remove options instead of just putting them in an advanced section or something.

View 3 Replies View Related







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