General :: Extract 5th Column From A File Without The Header?
Oct 15, 2010How can I extract 5th column from a file without the header.
View 5 RepliesHow can I extract 5th column from a file without the header.
View 5 RepliesI 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.
What I need to do is to extract one complete column (file size) from the output of ls -lS but while doing so in some rows I have a single space but in some other rows I have 2 or 3 spaces like some file sizes are different with 30 bytes 400 bytes and some 4000 bytes. So when I extract the output of ls using | cut -d ' ' -f5 i get the value which has only one space i.e. I get 4000 as output because 400 has 2 spaces seperated and 30 is 3 spaces separated. So how to get the file size column from the ls output?
View 10 Replies View Relatedwhere can i get socket.h header file? will copy pasting this header file in 'incl' directory allow me to use it in the my program?
View 1 Replies View RelatedI have a file which has the output as shown below:
Code:
Teams | matches |Goals | YC | RC
------------------------------------------------------------------------------
Liverpool: | | | |
Gerrard | 97 | 100 | 41665 | 1342
[code]....
I need to extract the Info from the RC column for the first 4 players of liverpool. The test code i have does the same,but can anyone show me a better way of doing it.I could do it easily with gawk -F"|" and print the respective column,but i need to do this in perl.
Code:
#!/usr/bin/perl
use strict;
use warnings;
[code]....
Asuming I have two files, one large file and one small file, I want to write the smaller file to the large file without overwriting the remaining part of the larger file.
Both are binary files, and the large file can become very large, so I want to avoid copying the whole file, as that will take some time. Is there any standard Linux console utility to do this, or do I need to write it myself?
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
...
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
I was trying to redirect the output of two variables to different columns of a .csv file in MS excel like this,
Code:
echo "$a $b" > abc.csv
But I am getting both $a and $b in the same column, is there anything I can use instead of to move the value of $b to the next column? Or is there a good different approach to do it?
I have a file like:
ER- V67
ER+ V68
ER- V69
ER+ V70
[Code]....
I am using the code:
sort -k1
but it prints it by sorting the second column.
I have 2 large text files , one looks like this:
<contact type="1">blahblah@hotmail.com</contact>
<contact type="1">blahblah2@hotmail.com</contact>
<contact type="1">blahblah3@hotmail.com</contact>
The other is a list of emails in single column format like this:
emailaddy@hotmail.com
emailaddy2@hotmail.com
emailaddy3@hotmail.com , etc
Is there a command to delete all the blahblah emails from text file 1 and replace them with the ones from text file 2?
Or maybe a linux version of 'Csved' which has the ability to add,remove,insert columns?
I have a file that stores employee login IDs, names, types, and permissions. Our software reads the information based on byte-columns, so it reads a column as any ASCII character (spaces, letters, numbers, punctuation, etc.). I want to create a web-interface for adding and removing users, and storing the data in a MySQL database. However, if I am creating the files from the MySQL output, I need a way to write to specific column locations in the file ...
User ID: Columns 1-4
User Name: Columns 6-30
Type: 32-40
Permissions: 42-45
I want to use a scripting language, preferably C-Shell, to call MySQL for the data and write the data to the correct columns of the file. I wrote a script that takes the data from the file, and dumps it into the MySQL table, so maybe I can pad the remaining space in the table column to fill with spaces ...
I have this .txt file
3183630 R
3574216 W
5264994 M
2656889 A
I want to sort it by the numerical order of column. After sort, I wish to get output like
2656889 A
3183630 R
3574216 W
5264994 M
anyone knows how to use sort to do that? or any other command?
shell commands for such two goals?
In a tab-delimited file,
Code:
1aIa11aa
2bIIa22aa
1cIIIaabcaa
4dIVaabcaa
1. How can I find the non-unique values in the 1st column (1, in this case)?
2. How can I find the non-integer values in the 5th column (abc, in this case)?
I am new to ubuntu.I have done some programming in c++ under windows using graphics.h header file.I want to implement my programs in ubuntu.How can i do this?I am writing a program.
View 4 Replies View Relatedi 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?
I know a .bin file is an executable file type in linux. We have an error after installing it and it referes to a file name and a line number within the file. I'm trying to find out if the file is part of the .bin file but I need a way to see what's inside of it or extract it.
View 5 Replies View Relatedit is possible to extract a value from a file with awk, grep or something similar. I have a file like this...
ID1,NAME1,LAT1,LON1,VAR1=5.0,VAR2=7.0,VAR6=9.0,VAR15=0.0,VAR20=0.0
ID2,NAME2,LAT2,LON2,VAR1=6.0,VAR15=1.0,VAR20=5.0,VAR22=0.0
ID3,NAME3,LAT3,LON3,VAR1=10.0,VAR2=20.0,VAR3=8.0,VAR10=3.0,VAR15=0.5,VAR20=9.0
[code].....
and I want to extract VAR15 from each line (which can be at any column unfortunately - columns separated with commas - csv file), or VAR15 together with LATn,LONn from each line. Is it possible to do it with awk, grep or something other in linux?
File in question is [URL].. meder@pc:~$ tar -xvjf wkhtmltopdf-0.10.0_rc2-static-i386.tar.bz2 bzip2: (stdin) is not a bzip2 file. tar: Child returned status 2 tar: Error exit delayed from previous errors
I tried to unzip it as well, and I tried a various slew of commands to no avail on my Debian box which has no GUI. I downloaded this on my local desktop ( Ubuntu ) and was able to easily extract w/ my mouse so I'm not exactly sure what the extractor did differently...
Im trying to extract the contents of a zip file but I want to extract it to my own directory. I'v tried -d from unzip but that just puts the contents of the zip into that directory.
But I want to extract the contents of the first (root) directory in the zip if there is only one directory in the root of the zip else just extract the files/folders in the root of the zip file (if there are more then one files).
e.g. test.zip contents the following dir structure:
test.zip
/app_v1/ <-The contents of this directory I want extracted to a dir of my choice
- folder-1
- folder-2
- folder-3
- folder-4
- file1
- file2
I have a file similar to this:
I need to print the last line for each user into a file. The resulting file should look like this:
Is there a way that AWK can match lines from $1 and then print the last line into a file?
I stay in /var/www/upload and I want extract a file with tar command.
The output of tar xfvz /var/www/file.tar.gz is
Quote:
tar: /var/www/esempio.tar.bz2: funzione "open" non riuscita: Nessun file o directory
tar: Errore irrimediabile: uscita immediata
tar: Child returned status 2
tar: Uscita con stato di fallimento in base agli errori precedenti
How do I extract a tar file from one directory to another.
e.g /data1/test.tar to /data2
I want to know how can I use sender an receiver of the email in name of file for storing mail in procmailrc. I made one but it does not work.
Quote:
SUBJECT=`formail -xSubject:` # regular field
FROM=`formail -rt -xTo:` # special case
:0 b
* ^FROM.*
| sed -e '/^To: +?[0-9]*$/,/report/!d' > ${FROM}${SUBJECT}--`mktemp 20`date +%y-%m-%d-%S--`XXXXXX`
it works when I use :
Quote:
| sed -e '/^To: +?[0-9]*$/,/report/!d' > `mktemp 20`date +%y-%m-%d-%S--`XXXXXX`
I have an ISO CD image file and want to extract it's contents to a folder. I know there are ways to mount the image and stuff, but it's complicated. I'm looking for a GUI tool to open up the contets and extract needed files. On windows I would use WinRar to do this. K3B only allows me to burn the stuff, Arch does not work with ISO files :(Is there a similar tool on Linux, preferably from KDE world?
View 6 Replies View RelatedI want to extract the file creation time. How to get it. I am using fedora core 4
View 3 Replies View RelatedI am using a Red Hat enterprise server 5.0 I would like to know if there is a way to extract a single file from inside a war file and display its contents on the screen? For example: I have a file labeled test.war and inside this war there are multiple files/directories. I am interested in seeing the contents of one file labeled MANIFEST.MF without having to unzip the entire war file. does it make sense?
View 6 Replies View RelatedI want to know if there is anyway I can extract the first few contents of a zipped file and then the next fixed and so on? For example, suppose I have a zipped file containing 1000000 natural numbers and I want to extract the first thousand numbers and then the next thousand numbers (1001-2000) and so on till I reach the end. Is this possible?
View 3 Replies View RelatedCode:
mencoder The.Negotiator.mkv -of rawaudio -oac mp3lame -ovc copy -o sound-mencoder.mp3
I got a 195.3MB mp3 file
[code]...
I'm Fedora 14 Kernel Linux 2.6.35.13-91.fc14.i686
I downloaded the new firefox and I don't know what to do with it.
What directory and file do I open it, or extract it to?