I have to rename all file names with first word of their content in unix I have to rename all file names with first word of their content in unix unix unix

I have to rename all file names with first word of their content in unix


You can use a for loop:

for fname in *.txtdomv $fname $(head -1 -q $fname|awk '{print $1}')done