General :: Removing Specific Field Seperator To Combine Two Fields?
Dec 2, 2010
I am trying to remove the space between the 2nd and 3rd fields but just cannot work out how to do it. I've considered sed, cut, awk...I know with sed you can replace all instances within a file but can you also specify to remove, say, the 2nd instance of a space in each line (this would be perfect for me)?
DAAE 60 402 Bejaia Algeria 1 36-43N 005-04E 36-43N 005-04E 2 2 P
DAAG 60 390 Dar-El-Beida Algeria 1 36-43N 003-15E 36-43N 003-15E 25 25 P
DAAJ 60 670 Djanet Algeria 1 24-33N 009-28E 24-33N 009-28E 1054 1054 P
[code]...
View 3 Replies
ADVERTISEMENT
Jan 10, 2011
I have a couple of MP3s that have duplicate fields in their ID3 tags. Let me show you what I mean: This is causing problems with some media players. Is there a tool that can automatically fix these MP3s in batch? I'd prefer a free Windows or Linux program. I'm not afraid to work on the command line if necessary.
View 2 Replies
View Related
Apr 24, 2010
I have a file containing text. I want to replicate a specific field.For example, I might want to append a copy of the second word of each line to the end of that line.Have: Once upon a midnight dreary, while I pondered weak and weary,Over many a quaint and curious volume of forgotten lore, Want: Once upon a midnight dreary, while I pondered weak and weary, upon Over many a quaint and curious volume of forgotten lore, many Is there a Linux command which will do this? I seek a basic command, not awk, not Perl, because I haven't learned those things yet.
View 14 Replies
View Related
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
Mar 20, 2011
I'm new to the shell scripting. can any one help in creating shell script for matching the content of the specific variable with file. it should remove that line from the file if line is containing same value as variable and keep the other content as it is.i used grep -v for accomplishing the same. But grep will remove the pattern which is similar.For eg. Assume file "test" contain datas :aaffif i used grep -v command for the pattern "a" to this file this will remove content "aa" from the file. I want the pattern only "a" should remove from the file, if it is existing. otherwise it should throw alert content not exists.
View 5 Replies
View Related
May 26, 2010
In postfix, how can I configured it to reject a message with a specific "Reply-to" field.
View 5 Replies
View Related
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
May 17, 2011
I am green on linux script. I would like to perform the following operation:String a: 1,2,3,2,4,How to unique this string to become: 1,2,3,4,?
View 3 Replies
View Related
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
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
Jul 12, 2011
I have a file1:
Code:
$ cat PF(1).out
Tmp39 PF10271.3 423 ENSP00000326063 488 1.2e-201 41-478
Tmp39 PF10271.3 423 ENSP00000338165 492 1.9e-200 46-479
[code].....
View 14 Replies
View Related
Feb 7, 2011
I'm trying to use awk to remove rows that are duplicates based on 3 fields, and I want to keep the on that has the higher value in another field. I'm working in C-Shell. For example the below is greped out of a larger data set to use in here as example:
Input (Field separator is a comma:
Code:
4180,-6999,MA,BARNSTABLE,BOURNE,1,1.7,1700,PM,1/26
4180,-6999,MA,BARNSTABLE,BOURNE,1,3.5,2025,PM,1/26
4180,-6999,MA,BARNSTABLE,BOURNE,1,1.0,1511,PM,1/26
4180,-6999,MA,BARNSTABLE,BOURNE,1,5.7,0540,AM,1/27
[Cpde]....
View 1 Replies
View Related
Mar 28, 2010
I'm writing a script that picks out the time offset in a string, but am trying to figure out a way to print a field based on a match (likely needs to be regex).
Here are some sample fields:
09.900. Either add -12:-1: 0 to existing offset, or restart the slicer with no offset or with offset=00
09.900. Either add -12:-1:30 to existing offset, or restart the slicer with no offset or with offset=00
09.900. Either add -10: 0:-47 to existing offset, or restart the slicer with no offset or with offset=00
What I need would be "-12:-1: 0" from the first line, for example. I was just using "awk '{print $4}'" originally but because of the damn space in the 1st and 3rd lines by the 0, that doesn't work for me. How to grab those fields correctly for all cases?
View 3 Replies
View Related
Feb 22, 2010
I'm looking for a way to dynamically modify a fied in the SQL file.
Example,
INSERT INTO `TABLE` VALUES(1AADFDF,DFF33D,10023,SOMEDATA, SOMEDATA);
INSERT INTO `TABLE` VALUES(1AADFDF,DFF33D,10098,SOMEDATA, SOMEDATA);
[code]....
The third field in this SQL file is what needs to change to n+1
"10023" needs to change to "1"
"10098" needs to change to "2"
"10123" needs to change to "3"
"10983" needs to change to "4"
etc...
I tried with awk and sed, but since both require the usage of ' (single quote), my variable fails to get updated. I know i can use cut and recreate the sql statememnt, but i believe there should be easier way using sed or awk. Would anyone know of any creative way to get this to work in one-liner? This needs to be a part of the script preferable without making call to external file.
View 1 Replies
View Related
Dec 13, 2010
For example: file a:Tom:blackLily:pinkfile b:Tom:bigKate:smallAnd, the result:join -t: a1 a ot:Tom:black:bigLily:pinkBut what I want is:Tom:black:bigLily::pink
View 2 Replies
View Related
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
Dec 2, 2010
for example
else {
for fileDOC in $location/*.doc
do
[code]...
View 12 Replies
View Related
Feb 26, 2011
I have following in cpuinfo:
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
[code]....
View 2 Replies
View Related
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
Apr 3, 2011
how to combine bash scripting with apache.
View 5 Replies
View Related
Mar 22, 2011
Combine multiple text files into one text file?
View 5 Replies
View Related
Jan 11, 2011
How can I join the two parts of a stereoscopic movie to get a side-by-side one?
I can expand the left file, that way all I'll need is to paste the second one on top of it, with something like this:
mencoder left-file.mkv -o side-by-side.avi -oac copy -ovc lavc -of avi -vf scale=1280:720,expand=-1280:0:0:0 -sws 3 -lavcopts vbitrate=16000
Any idea which tool should I use on a Linux system?
View 1 Replies
View Related
Jun 12, 2011
I have hundreds of files in one directory, is there a simple command or pipes of command I can use to append them together? I don't want to use any loops.
View 4 Replies
View Related
Jul 7, 2011
I have two files: one is like
preface
Introduction
chapter 1
the other is like
1
2
3
I was wondering how to column-wise combine the two files into one:
preface 1
Introduction 2
chapter 1 3
by using some utilities, such as awk, sed, available in Ubuntu?
View 1 Replies
View Related
Oct 25, 2010
I am using Red Hat Linux enterpriser 4 using two physical LAN cards.There are two different ISP internet lines coming into a single gateway computer. Is it possible that if in our one network we are using 2 MB bandwidth and from another network we are getting 2 MB bandwidth.(Two different Networks) and combine it into 4 MB. In bonding it combine the bandwidth or it do loadbalancing ?
The question is can we accumulate or add these two bandwidth in Linux machine and it sent total bandwidth 4 to the end users ?
Lan Card A
IP Address: 192.168.1.250 2MB Bandwidth
l
l
l
[Code]....
View 2 Replies
View Related
Mar 1, 2011
I am using a cluster of machines running on Ubuntu 10.04 LTS which are supposed to be homogeneous, but apparently they are not. In particular, I am configuring the X server on these machines.The problem is that the BusID of the graphic card is PCI:5:0:0 for some machines, and PCI:3:0:0 for others. Is there a way that the X server automatically detects the appropriate Device (based on the name for instance)?
View 1 Replies
View Related
Sep 1, 2010
I have one file placed at one server whose sample as follows:
57272 28
56767 0
57575 4
[code]...
View 13 Replies
View Related
Jun 1, 2010
i have 2 file and want to merge them in the first one. the first file is like this:
2 word1
1 word2
6 word3
2 word4
......
the second:
word1 :file1 :file2
word2 :file6
word3 :file1 :file2 :file2 :..up to file6
word4 :file7 :file1
.......
So i want to ADD all those File fiels Wich have different FN for every record.
View 8 Replies
View Related
Sep 27, 2010
I would like to know the command to change or add GECOS field of existing user. when i tried to find the command i end up getting this which is only valid for new user account.
Code:
useradd --help
-c, --comment COMMENT set the GECOS field for the new user account
My system details.
Code:
# lsb_release -a
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: OracleVMserver
Description: Oracle VM server release 2.2.0
Release: 2.2.0
Codename: n/a
View 1 Replies
View Related
Sep 1, 2010
In my file there are 2 fields separated by space.Sample content of file are as follows:56060 154242 053030 0Now i want to check second field of the file and if all values in second field are 0(zero) and send mail containing all contents of the file
View 3 Replies
View Related