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

0 votes

Hi Team,

I have one CSV file. I want to extract some text from each line. How can I do that?

Oct 19 in Linux Administration by akhtar
• 32,960 points
47 views

1 answer to this question.

0 votes

Hi@akhtar,

There is no inbuild command available for your requirement. But you can create your own customized command. To select some texts from a file, you can use the cut command as shown below.

$ cat data.csv | cut -c 1-6
System
569,Ha
570,Ha
571,Ha
572,Ha
answered Oct 19 by MD
• 77,580 points

Related Questions In Linux Administration

0 votes
1 answer

generating a list of files with their absolute path in Linux

If you find an absolute path to start with, ...READ MORE

answered May 16, 2019 in Linux Administration by Upasana
• 8,620 points
125 views
0 votes
1 answer
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

How to change permissions of folder and files in folder?

The chmod command is used to set/change the permissions ...READ MORE

answered Jan 31, 2019 in Linux Administration by Omkar
• 69,030 points
152 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
0 votes
1 answer

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

Hi@akhtar, You can extract text from a file. ...READ MORE

answered Oct 19 in Linux Administration by MD
• 77,580 points
28 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