How to find the first field from a file in Bash Shell?

0 votes
Hi Team,

I have a huge file on the Linux server. I want to find the first field from that file. How can I do that in Bash shell?
Oct 19 in Linux Administration by akhtar
• 32,960 points
28 views

1 answer to this question.

0 votes

Hi@akhtar,

You can extract text from a file. In Linux, you can find the cut command. In this command, you can pass -f as a field as shown below.

$ cat data.csv | cut -d ',' -f 1
answered Oct 19 by MD
• 77,580 points

Related Questions In Linux Administration

0 votes
2 answers

how to loop through the content of a file using bash

#!/bin/bash for i in  `cat peptides.txt` do echo $i done READ MORE

answered Sep 4 in Linux Administration by Prakash K. Aithal
901 views
0 votes
1 answer

How to find the group associated with a user in linux?

To list all the groups groups or to list ...READ MORE

answered Jun 20, 2019 in Linux Administration by DareDev
• 6,870 points
205 views
0 votes
1 answer

How to take input from user in bash script?

You can use if-else branch to check ...READ MORE

answered Jan 31, 2019 in Linux Administration by Omkar
• 69,030 points
153 views
0 votes
1 answer

Select sections of text from each line of files in a Bash shell.

Hi@akhtar, There is no inbuild command available for ...READ MORE

answered Oct 19 in Linux Administration by MD
• 77,580 points
47 views
0 votes
1 answer
0 votes
1 answer

setting a variable output from a bash command

You can use $(command), which in my ...READ MORE

answered Feb 15, 2019 in Linux Administration by DareDev
• 6,870 points
793 views
0 votes
1 answer

How to sort text alphabetically in Linux system?

Hi@akhtar, In the Linux system, you will find ...READ MORE

answered Oct 19 in Linux Administration by MD
• 77,580 points
36 views
0 votes
1 answer

How to check permissions of a file in the Linux system?

Hi@akhtar, If you prefer using the command line, ...READ MORE

answered Aug 13 in Linux Administration by MD
• 77,580 points
146 views
0 votes
1 answer

How to check permissions of a folder in the Linux system?

Hi@akhtar, You can use ls command to check ...READ MORE

answered Aug 13 in Linux Administration by MD
• 77,580 points
131 views