General :: Convert Irregular Lines Into Formatted Column Using Awk?

Apr 17, 2010

I'm newbie to awk scripting. Need your great help to convert the irregular lines into column using awk (Sorting based on "Pri Number" column)

Input files is as follows:

Partition Name OA
Partition UID: 88:93:22:AE:B3:42:DF:11:A8:64:00:60:16:36:04:02
HBA/SP Pairs:

[Code]...

View 2 Replies


ADVERTISEMENT

Programming :: Replace Pattern In Specific Lines And Column With AWK?

Apr 24, 2010

Im tryng to replace in specific column and line number within a file where its 3erd column contain the same string in all lines.

[code]....

My goal is to replace only first and last ocurrences of "Normal player", with the following desired output:

[code]....

Im not sure how to use the "IF" and "AND" conditions together. I�ve tryed with the code below, but the script replaces the string for every line.

[code]....

how to replace values for specific column in first and last lines within same AWK script, without taking reference data in other columns?

View 10 Replies View Related

Programming :: Add Blank Lines Whenever The Value Of A Given Column Alters In A Data File?

Jan 7, 2011

All I want is a command that reads one data file with several columns and prints it in another one.However, whenever the value in one specific column alters, it prints one empty line in the new file. For example, consider the file

2.54000000 2.54000000
2.54000000 2.54000000
2.54000000 2.54000000
2.54000000 2.56000000

[code]....

View 9 Replies View Related

Fedora :: Convert LVM Volume Formatted Ext2 To Ext3?

Nov 5, 2010

I have a question, i accidentally formatted an lvm volume as ext2 after creating it. Then of course, we copied a ton of data to it before I realized it was ext2. (I guess ext2 was the default when using mkfs without a -t) Anyway - can I just use tune2fs -j on the LVM just like I would a /dev/sdx device?

View 2 Replies View Related

Ubuntu Installation :: Reformatting - Delete Convert NTFS Formatted Drives To Ext3

Jul 9, 2011

I've lost my admin password on my current Windows OS and would like to install Linux Ubuntu or a similar user-friendly distro of Linux alongside, see how that goes and possibly reformat my PC with Linux as I was told it would convert NTFS formatted drives to ext3, not delete them.

View 9 Replies View Related

General :: Calculate 3rd Column Which Should Be Addition Of Value In 1 And 2nd Column?

Jul 19, 2010

How would i calculate following values.Initial file

10 3
20 4
How would i calculate 3rd column which should be addition of value in 1 and 2nd column.File after calculation
10 3 13
20 4 24

View 14 Replies View Related

General :: Awk Gsub() Command - String (column) Manipulation - Replace The Value Of The $1 Column In The Awk Print String?

Mar 7, 2010

i use this script to get the time and date of back and fourth transactions for a particular execution id. I use a substr command on the 5th column to to cut the milli seconds off the time value. - otherwise the times would look like 08:30:04.235

grep <executionID> <auditfile> | awk '{ print $1, $2, $3, $4, substr($5,1,8}
FIX -> Mon 3/1/2010 08:30:04
FIX <- Mon 3/1/2010 08:32:36
FIX <- Mon 3/1/2010 08:35:08

[code].....

anyhow - i append two sed commands to further clarify the direction of the message.

awk '{ print $1, $2, $3, $4, substr($5,1,8} | sed -e 's/->/ ->IN/g' | sed -e 's/<-/<-OUT/g'
FIX -> IN Mon 3/1/2010 08:30:04
FIX <- OUT Mon 3/1/2010 08:32:36

[code]....

I tried using an awk gsub () command within the string instead of the two seds, but it did not work:

awk '{ print gsub(/<regex>/, <replace with>,$1), $2, $3, $4, substr($5,1,8}

the sed works ok, but it would be cooler to make the replacement within the awk command:

gsub(/->/,-> IN, $1)

Is there a way where i could replace the value of the $1 column in the awk print string?

View 1 Replies View Related

Programming :: Convert Few Lines Of SHELL Script To DOS Batch

Apr 14, 2011

I really need help with this part of a shell script which I am trying to migrate to DOS batch script.

View 3 Replies View Related

Programming :: Shell Script To Convert Values On Successive Lines Into Consecutive Ranges?

Jul 7, 2010

I have a series of input files formatted like this:

Code:

RTREVF, KOG3266 = 111
RTREVF, KOG3294 = 130
RTREVF, KOG3295 = 177
WAGF, KOG3307 = 107
JTTF, KOG3320 = 174

Each line represents a portion of a data matrix. I want to convert the numbers after the "=" to the range of that partition in the matrix such that the output file looks like this:

Code:

RTREVF, KOG3266 = 1-111
RTREVF, KOG3294 = 112-241
RTREVF, KOG3295 = 242-418
WAGF, KOG3307 = 419-525
JTTF, KOG3320 = 526-699

View 5 Replies View Related

General :: Find Mechanism With Irregular Expression (find Command) Or Perl?

Sep 7, 2010

I have 4 Linux machines with cluster.My target is to find all kind of IP address (xxx.xxx.xxx.xxx) in every file in the linux system remark: need to scan each file in the linux system and verify if the file include IP address if yes need to print the IP as the following

more /etc/inet/file.example1

182.23.2.4
255.255.0.0
10.10.1.1

View 1 Replies View Related

Programming :: Awk Multiple Column Into Single Column?

Jul 15, 2010

I have a multicolumn datas, like

a1 b1 ... f1
a2 b2 ... f2
. . ... .

[code]...

I would like to make a file with all these data in one column, like

a1
a2
.
.

[code]....

Can it be done with awk or some other command? Also, is it possible then do add another column in front of this one with numbers of the lines (for every previous column), like

1 a1
2 a2
. .
. .

[code].....

View 14 Replies View Related

General :: Delete All Lines Containing A String, Plus 4 Lines Below It?

Jan 26, 2010

I've come across an unusual requirement for a service in my Ubuntu system.Simply put, I need to find a way to search for all instances of a term in a file, delete lines containing containing that term, and delete four lines below each instance of that term. ither that, or copy the entirety of a file to a new file and skip over all lines containing the term plus four below it.This sounds kinda weird, I know. Without going too far into detail, I either have to change the logfile format for a server I'm running which is a huge pain in the butt, or I can just run a script to edit an HTML report generated from said logs. (Said report is really just for managers to peruse, and I like my log format, so I'm pursuing option 2.)

View 4 Replies View Related

OpenSUSE :: Plasma-Theme Changings Irregular?

Jan 28, 2011

Can't change the Plasma-Themes in System-Settings/Desktop-Theme Detail any more!Changed the user,same
behaviour ("Apply"-button not highlighted after selecting a theme)!And more confusing,in the System-Settings/Appearence/Style/Workspace setting,there I can changethe Plasma-Themes !Downloaded a Plasma-Theme before from Kde-Look.org,that seems not to work,deleted it,but no changing.

View 2 Replies View Related

Programming :: Irregular 2D Array In Shell Script

Aug 16, 2010

I am trying to create a shell script to automate a process that takes inputs from two sets of data. The variable SHELL in my system echoes as /bin/tcsh, but I see that my /bin directory has other possibilities, such as bash. So, if changing the shell could simplify my problem, then I would go with that.

I have a list of files containing data about objects, say
obj1.dat, obj2.dat, .... objn.dat, where n is around 20 (it varies).
These objects belong to a few different categories, and there are files detailing the properties of the categories, say
cat1.prop, cat2.prop, ... catm.prop, where m is smaller than n (more than one object in each category).

I know that shell scripts can handle 2-d arrays, although I am not sure how. The thing here is that category 1 could have 5 objects and category 3 could have 7 objects. So, this could produce a 2-d array, but not a rectangular one. I need to process these files taking into acount the data about the object and the properties of the category the object belongs to. Here is what I tried to do:

# First I enter a list of category names and m lists of objects in each category
category='cat1 cat2 cat3 ... catm'
cat1-obj='obj1 obj2 obj3'
cat2-obj='obj4 obj5'
cat3-obj='obj6 obj7 obj8 obj9 obj10'
.
.
.
catm-obj='objx objy objz objn'

# The lines above show the irregular 2-d array. Then I try to trick the script into parsing through this irregular 2-d array:
for i in $category
do
data='$i -obj'
for j in $data
do
mycommand $j.dat $i.prop > $j-$i.out
done
done

The line "mycommand $j.dat ..." is just the line that processes the information. That has been tested to work fine. Feeding the information to this is what does not work. The lines " data='$i-obj' " and " for j in $data " do not have the desired effect. I have tried other ways, like data=`echo $i "-obj"` and things of the sort, by to no avail.

View 1 Replies View Related

OpenSUSE Wireless :: WiFi Connection Dropping At Irregular Intervals

Jan 5, 2010

In summary, I am using openSUSE 11.2 x64 on an Acer laptop with a wireless AR928X card. I can connect to my WEP-secured network when I boot up. After some time (it might be minutes, it might be hours), I am prompted for my WEP password again. This never works, despite being the one which gets me on-line at start-up!. The only solution is a reboot. The problem is intermittent and doesn't seem to depend on my on-line activity. I have tried the following with the same result:
KNetworkManager
Traditional using IFUP
Enabling / disabling IPv6 support

I tried installing the compat-wireless package through YaST and then managed to get no internet connection at all. Went back to KNetworkManager and things "worked" again until I was prompted for the WEP code. I have openSUSE 11.2 x64 working on my office laptop without problem and can connect to my home network without any problem. My issues are with my personal laptop. I have reached the stage of booting into Windows 7 as my default option so that I can access the internet reliably. What I can do to diagnose and repair the problem - could it be that the card is going into powersave mode? If so, how do I stop that happening? I'd prefer to be on openSUSE but need to be able to rely on the internet.

View 9 Replies View Related

General :: Using Convert From Imagemagick Package To Convert Multiple Jpg Files?

Jul 18, 2010

I'm trying to use convert, I have installed the imagemagick. I use this line:convert *.jpg test.pdf but I'm only able to convert to pdf 1 single jpg file, not multiple files at once. When there's more than one file, I get the following error: Segmentation fault

View 5 Replies View Related

General :: Insert Column With Awk / Sed Between Two?

Jan 18, 2011

I have a two column file and I need to create a new column in between the first and second but the new column adds a value to the first. E.g.code...

I thought I had figured out how to do it with the following but it just hangs:

awk -F '{print $0,$0+25,$1}' file_in > file_out

Also tried the following to no avail:

awk -F,-v OFS,'{print $0,$0+25,$1}' file_in > file_out

I can add the new column with the added value to the last column easy ( awk '{print $0,$0+25}' file_in > file_out).

View 8 Replies View Related

General :: Data Recovery From Formatted HDD

Feb 10, 2010

While install Ubuntu on an existing xp pro I accidentally formatted my hard disk. Is there any way to get back my files it contains e books pdfs photos music files and movies. Data recovery. My Hard Disk 80GB SCSI NTFS.

View 2 Replies View Related

General :: Puppy Kernel Does Not See Formatted HD

Sep 2, 2010

I have recently inherited an old xseries eserver 220 with 1.2ghz intel pentium III processor. I can boot puppylinux fine from the cd, but puppylinux does not see the hard drive even though it shows up in the bios sysutilities and I formatted the hard drive from the bios.

View 4 Replies View Related

General :: First Column Of Vim Highlighted Yellow And Won't Go Away?

Feb 23, 2011

I have not defined a user vimrc, OS is redhat 4.6 and after a search and replace the first column in the editor is highlighted yellow and it stays that way as I close and open vim. This is the /etc/vimrc that came on the system. anyone see a bug or a reason it would do that?

if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=utf-8,latin1
endif
set nocompatible " Use Vim defaults (much better!)

[Code]....

View 2 Replies View Related

General :: LS And OD Command - First Column Will Be Always 000000

Oct 20, 2010

1. when we run od command it displays octal values. But the first column will be always 000000. after that the actual file contents are displayed. Can anyone tell the meaning of that.

2. When we run ls -l command, in the first line of the output, we can see some integer value. What is the significance of that value.

View 4 Replies View Related

General :: File Name In Separate Column?

Apr 26, 2010

I have some series of files, which actually named bellow

<day_month_yr>_<hh:mm:ss>.<host_name>.<IP.ip.ip.ip>.<log_name>.txt

I want to show this file name below the column may be

Date Time Host_Name IP_address Login_Name
----- ---- --------- ---------- ----------
<day_month_yr> <hh:mm:ss> host_name x.x.x.x log_name
...

View 5 Replies View Related

General :: Use Awk To Matching In Only A Specific Column?

Jul 12, 2010

Im trying to use awk to do matching in only a specific column

example.txt:
www.google.com www.example.com
www.google.com/search www.example2.com
i used:
awk '{ (if $1 == "http://www.google.com") print $2}' example.txt

this awk statement only returns the first line, and i cant seems to make it perform in a way to match based on keywords like GREP. Is there any way to make display the other lines which contains "google" also?

View 1 Replies View Related

General :: How To Modify Some Particular Elements Of Column

Feb 22, 2010

It is very important for my research work. For example mydata.txt:
id type x y z
1 6 0.474611 0.227223 0.583947
2 4 0.422894 0.22726 0.536791
3 5 0.448963 0.200148 0.560336
4 3 0.386478 0.207721 0.515293
5 6 0.371617 0.22361 0.582206
6 4 0.32123 0.222999 0.534782

How to change second column (type) whose values are 4 and 3 to value 1, so that mydata.text file become:
id type x y z
1 6 0.474611 0.227223 0.583947
2 1 0.422894 0.22726 0.536791
3 5 0.448963 0.200148 0.560336
4 1 0.386478 0.207721 0.515293
5 6 0.371617 0.22361 0.582206
6 1 0.32123 0.222999 0.534782

View 6 Replies View Related

General :: Unable To Extract Last Column From Awk

May 20, 2011

I have a basic question of awk.

Code:

var=/test/build/create/sls
echo $var | awk '{ FS = ":" ; print $NF }'
/test/build/create/sls

I am trying to extract last column from the above awk one liner.

View 4 Replies View Related

General :: Unable To Use AWK To Modify Column

Jul 28, 2011

I want to use awk to modify file like this

origin:

A[]A[][]A[]A

modified:

A[]a[][]A[]A

but when I use

awk '{$2="a"; print $0}' inputfile

the output is

A[]a[]A[]A

where the [] means space. This is not what i want. I guess that is because the OFS is one space by default, but i really don't know how to solve this.

View 11 Replies View Related

General :: Replacing Character / Value In Certain Column

Jun 21, 2011

I need to replace a value in a file. For example the content of data.txt file is:
1 1 23
2 1 42
3 2 52
4 2 62
5 1 77
6 1 88
7 2 99
8 1 100

Could I substitute 2 in second column with 3 using awk and or sed or other command so that the data will be change as follow?
1 1 23
2 1 42
3 3 52
4 3 62
5 1 77
6 1 88
7 3 99
8 1 100

View 3 Replies View Related

General :: How Do I Sort Output Of Du By Its First Column

Mar 30, 2010

How do I sort the output of du by its first column. I issue the command this way:$ du.Is there a way?

View 5 Replies View Related

General :: Windows - Mount A USB Drive That's Been Formatted On A Mac?

May 1, 2010

Is it possible, using Ubuntu 9.04, to mount a USB HDD that's been formatted on a Mac (HFS+?)

View 5 Replies View Related

General :: Formatted HDD - Erased XP - Installed Backtrack 4

Apr 8, 2010

In what started as a quest to get free wifi, I have recently gotten in way over my head. After unsuccesfully trying to use a virtual drive, I decided to erase my HDD on my laptop completely, wiping out my Windows XP and installed Backtrack 4 in it's place.

My goal amongst others, was to create a 20% partition for Backtrack and run XP on the rest of it. Well, I couldn't figure out how to do it. My only option was format and install backtrack.

So now I'm typing on my iPhone cuz I know absolutely nothing about Linux or how it works. My computer has no Internet. It doesn't recognize my Ethernet NIC, my wireless card and probably alot of other stuff.

SO ANYWAYS I don't want to give up. I'm ready to learn. I guess the first order of business is to get my Ethernet Card working so I don't have to type on this damn phone. So how do I do it?

Here is the hardware list:

View 14 Replies View Related







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