-c option is used to cut columns. give the starting column number from where you want to cut. you can specify a range using an hyphen(-).
for cutting a single column say only 27 use
for cutting columns 27 to 31 use
for cutting 27th and 29th column use
for cutting columns from 27 till the last column an you dont know the column number then use
if ypu dont specify the end column, it will cut till the line ends
if you want to cut from 1st column to 27th use
Hi All,
We have a requirement of picking nth position value by using cut command. value would be delimited by any symbols. We have to pass delimited value and postition to get the value in a string.
ex.
echo "A,B,C,D,E" |cut -d "," -f3
echo "A|B|C|D|E"|cut -d "|" -f2
Kindly frame the... (5 Replies)
Hi All,
I am having a huge file file. I need to cut the below column and do the below calculation
I did the below command and able to do on full databased no on the individual based any help on doing each row by row
cut -c 52-56 myfile | awk '{total = total + $1}END{print total}'... (7 Replies)
i want to find the position of a character in a line , the first position, last, 5th occurence position , i ve tried grep -n , and expr index but they dont fit the bill. Please let me know if there is any other alternative (2 Replies)
not sure how to do it. wan't to delete it using cut and grep ince i would use it in the shell.
but how must the command be?
grep "64.233.181.103 wwwGoogle.com" /etc/hosts | cut -d
the delimeter is just a space. can you help meplease. :D (1 Reply)
How to extract multiple data based on character position. I need to fetch from 7-9 and 22-26 and there is no delimiter for 22-26 since it is part of the column. The file may have more than 1000 character long.I managed to pull any one but not both
for example
test data
12345 zxc vbnmlk... (1 Reply)
Hi,
How can i move to particular line and to a particular position in a file using unix commands ?
eg: in the line 30 and position 10 i want to print my name in a file.
Cheers,
Mohan (1 Reply)
Hi All,
I wish to cut an input by using the below command but i would want to have the cut position as a variable.
For eg, the position number is 11 now and i wish that this number is being assigned to a variable before putting into the cut function.
Can this be done ?
Can any expert help?... (1 Reply)
Hi folks
I have a file with thousands of lines with fixed length fields:
sample (assume x is a blank space)
111333xx444TTTLKOPxxxxxxxxx
I need to make a copy of this file but with only some of the field positions, for example I'd like to copy the sample to the follwing: so I'd like to... (13 Replies)