Link to home
Create AccountLog in
Unix OS

Unix OS

--

Questions

--

Followers

Top Experts

Avatar of dudup
dudup

csh script to read a text file
Hi,

I need help to create a small csh script.

I have a text file (codes.txt) contains :

CODE1217261
CODE9723763
CODE3864383
CODE3874638

I want to read it one line at a time, and pass it as parameter <code> to a command line:

     command -F -x <code> | wc -l

Thanks for any help.

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of TintinTintin

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of ahoffmannahoffmann🇩🇪

sed -e 's/.*/command -F -x & |wc -l/' codes.txt|sh

Avatar of ozoozo🇺🇸

xargs -n 1 csh -c 'command -F -x $* | wc -l' < codes.txt

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.

Unix OS

Unix OS

--

Questions

--

Followers

Top Experts

Unix is a multitasking, multi-user computer operating system originally developed in 1969 at Bell Labs. Today, it is a modern OS with many commercial flavors and licensees, including FreeBSD, Hewlett-Packard’s UX, IBM AIX and Apple Mac OS-X. Apart from its command-line interface, most UNIX variations support the standardized X Window System for GUIs, with the exception of the Mac OS, which uses a proprietary system.