Help to know about an error related to awk command in cmd
0
0
Entering edit mode
2.2 years ago
Madhawa ▴ 10

Dear all,

I am trying to use the following command in my command line.

grep "PROBLEM" plink.sexcheck| awk '{print$1,$2}'> sex_discrepancy.txt

However, I was unable to get the results since there is an error as follows.

"awk is not recognized as an internal or external command, operable program or batch file"

I tried to find a solution for this error but I could not find a possible solution how to solve this issue. Could you please help me to know whether there is any possible solution for this error? Thanks in advance!

plink cmd Linux awk • 2.7k views
ADD COMMENT
1
Entering edit mode
grep "PROBLEM" plink.sexcheck | awk '{print $1, $2 }' > sex_discrepancy.txt

Probably, you just need to add a space before the | pipe operator. If it still doesn't work, test if awk is installed on your system with which awk.

ADD REPLY
0
Entering edit mode

Thank you so much for your prompt answer! I tried with a space and the error still appears. I just typed 'which awk' in my cmd. But still same error appears. Could you help me to understand about 'which awk' and how to install awk? I really appreciate your help!

ADD REPLY
0
Entering edit mode

AWK installation depends on your operating system: https://command-not-found.com/awk

ADD REPLY
0
Entering edit mode

Thank you for the useful information. As you suggested, I tried this command in cmd in my windows computer: sudo apt-get update sudo apt-get install gawk

It showed sudo is not recognized as an internal or external command. So, I run it without sudo. Then, it showed me apt-get is not recognized as an internal or external command.

I don't have any idea about this issue. Kindly give me any possible suggestion I need to follow that would be very helpful for me. Thank you!

ADD REPLY
1
Entering edit mode

You're using Windows, not Linux. If you want Linux then install WSL2, then some Linux Distro from the Microsoft store (I recommend the latest Ubuntu LTS) and (optionally but I highly recommend it) Windows Terminal.

ADD REPLY
0
Entering edit mode

Thank you for your information. I found that it would be better to use linux and will try to do it with linux!

ADD REPLY
1
Entering edit mode

Since roughly 99% of Bioinformaticians use either MacOS or Linux, basically all commands that you will find in tutorials and which that are to be entered into a terminal will not work out of the box with Windows.

How to deal with this problem depends on your goals: In case you plan to learn Bioinformatics and to frequently analyze data, you should try to install or get access to a Mac or Linux computer. If you just need to filter that one file, the easier option would be to use a web application for this.

You can for example register at Galaxy and then filter your text file there. In the section "General Text Tools", filter the rows by the term "PROBLEM" and then output the first two columns. (This is what your commands do).

In case you are starting your Bioinformatic journey with this commands, you should try to get access to Linux somewhere. You can install Linux on your computer locally, either directly or via Docker, but I would not recommend doing that for data analysis purposes (unless you have a really performant computer).

If you are a student at a university, it is very likely that you can access a pool computer somewhere that already has Linux installed and with which you can practice. Perhaps, you may even remotely connect to an HPC-system (high-performance compute system) via SSH from home. The Windows SSH-client is called PUTTY, which you need to install first. Furthermore, you need some login information to the HPC that you can get from your university's IT department. Getting acquainted with Linux and using a HPC system will be very useful if you intend to frequently do bioinformatic data analysis in the future, but will require some learning.

ADD REPLY
1
Entering edit mode

Thank you so much for your detail information. As you mentioned I found that it would be better to use linux to run this analysis and I will procced with using linux! Thank you once again for your kind help!

ADD REPLY

Login before adding your answer.

Traffic: 1554 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6