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
ADVERTISEMENT
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
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
Sep 20, 2010
I am doing a spreadsheet for work (for importing data into a new database) and I have hundreds of image files which need to have just their file names in one column called Product Code. Is it possible to use the ls command to list the contents of a directory in one single column so that I can copy and paste to the spread sheet?
Also, is there a single command to remove the file extentions for a batch of files? Bulk rename is what I need, I guess but just to remove the file extension (.jpg on all of them). The normal use of ls lists them in multiple column form and when I copy and paste those it will not let me copy just one cloumn at a time. The spreadsheet only has three columns:
New Product Code Old Product Code Pictures New Product Code will be left black, and the Old Product Code is just the image names. The picture column will be the patch-to-the-image for each image. I am not sure that is even possible in a spreadsheet.
View 14 Replies
View Related
Mar 3, 2009
I like running sql queries from the command line.
Code:
sqlite3 foo.db "select * from some table"
How can I specify
Code:
.mode column
at the command line?
View 1 Replies
View Related
Feb 4, 2010
What is the macro command (in OpenOffice Basic) to select an entire Row or Column? I tried to "Record Macro", then click on the Row/Column header, which would then select the entire row/column. But "Record Macro" failed to capture this action.
View 1 Replies
View Related
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
May 13, 2011
Have this script which is reading in a series of files, one at a time with while-do-done loop, each file goes through various greps/awk's where this info is then saved to various files for later use. i.e....
Script is being run on Linux Red Hat,
In one of the grep/awk's the output (currently) are 2 columns (min max), i.e....| awk '{print $1, $2}' | sort -u which outputs (e.g.)
The number of "min max" pairs varies from file to file. Want to output a single column of unique numbers from the min max pairs & get the number of them for input to a file...i.e...
Where <PROCESS> is some process/technique that will generate a single column of integers (increment of 1) to pipe into the next one (sort -u)
i.e. (example from above)
Have tried command seq - only works for single pair input i.e.
Is there any command like seq etc which will output a single column based on a input of min max numbers (increment 1) to pipe onwards to next command?
View 4 Replies
View Related
Mar 13, 2011
Is there a way to get the "ls -l" command to align its columns (e.g. force a fixed size) when the command is executed individually for each file to be listed (e.g. in a script loop or such)? Right now, I get ragged/jagged columns because "ls -l" is trying to make each listing compact horizontally. But as file sizes, and lengths of owner names, and such vary, the overall length of each output instance varies, making the columns ragged.
View 5 Replies
View Related
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
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
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
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
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
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
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
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
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
Aug 28, 2010
I know what are hard and soft limits, but what means "blocks" column in edquota utility?
View 1 Replies
View Related
Oct 15, 2010
How can I extract 5th column from a file without the header.
View 5 Replies
View Related
Nov 23, 2010
Ubuntu 10.10
Gnome desktop
On a text file, .txt, it is possible to high-light and copy a row on a table. But how to high-light and copy a column.
View 14 Replies
View Related
Apr 25, 2011
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?
View 2 Replies
View Related
Jun 24, 2011
I have this piece of code with some template strings.
Code:
Big_L: $Big_L
$Big_R
$Lambda_tf
$Epsilon_1
$mu
$n_0
$ms
$Delta_R
$Epsilon_2
$Lambda_d
$Epsilon_3
$Small_N
$Small_Q
How can I insert exactly the same template strings in front of each string, but just without the '$' sign (see the first line for an example)?
View 7 Replies
View Related
Mar 19, 2010
I have a text file and I need to replace the 3rd column of that file from row 3 to the end of the file with a column which I have stored in the different text file. For e.g the original file is like given below:
a.txt nobla 6 gadf 72.500 1.600 1.800 .850 5.250 8.540
A# rad ang ht prf bk sd dia type blade
1 0.3081 9.00 1.9235 -17.50 18.00 -3.00 0.6250 1613 1
2 0.6509 194.00 2.0316 -17.50 18.00 -3.00 0.6250 1613 4
3 1.0128 8.00 2.1457 -17.50 18.00 -3.00 0.6250 1616 1
4 1.3748 192.00 2.2598 -17.50 18.00 -3.00 0.6250 1616 4
5 1.6986 7.00 2.3619 -17.50 18.00 -3.00 0.6250 1616 1
6 1.9347 120.00 2.4364 -17.51 18.00 -3.00 0.6250 1616 5
7 2.1327 190.00 2.4988 -17.34 18.00 -3.00 0.6250 1616 4
So lets say I wanna replace column 3 from row 3 to row 7 with a data from another file which is given below:
54.00
239.00
53.00
237.00
52.00
165.00
235.0
So the final output file should be like this:
a.txt nobla 6 gadf 72.500 1.600 1.800 .850 5.250 8.540
A# rad ang ht prf bk sd dia type blade
1 0.3081 54.00 1.9235 -17.50 18.00 -3.00 0.6250 1613 1
2 0.6509 239.00 2.0316 -17.50 18.00 -3.00 0.6250 1613 4
3 1.0128 53.00 2.1457 -17.50 18.00 -3.00 0.6250 1616 1
4 1.3748 237.00 2.2598 -17.50 18.00 -3.00 0.6250 1616 4
5 1.6986 52.00 2.3619 -17.50 18.00 -3.00 0.6250 1616 1
6 1.9347 165.00 2.4364 -17.51 18.00 -3.00 0.6250 1616 5
7 2.1327 235.00 2.4988 -17.34 18.00 -3.00 0.6250 1616 4
And I will post the code whatever i have tried soon. I started with awk and cut commands..but never got it to work and also tried PASTE command too.
View 3 Replies
View Related
Oct 2, 2010
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 Related
Jun 22, 2010
i wanna sort the 3rd column in a table numerically ( no actual borders...only tabs seperating the columns)
it should be something like this but i cant get it right
Sort -u +1 -3 results
the file is called results
View 7 Replies
View Related
Jul 13, 2011
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.
View 8 Replies
View Related
Jul 17, 2011
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?
View 5 Replies
View Related
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
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