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, 2020 in Linux Administration by akhtar
• 38,170 points
131 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, 2020 by MD
• 95,180 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, 2020 in Linux Administration by Prakash K. Aithal
1,252 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,890 points
257 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,130 points
246 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, 2020 in Linux Administration by MD
• 95,180 points
87 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,890 points
1,014 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, 2020 in Linux Administration by MD
• 95,180 points
194 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, 2020 in Linux Administration by MD
• 95,180 points
309 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, 2020 in Linux Administration by MD
• 95,180 points
896 views